Teaching video generation method and device, electronic equipment and storage medium
By receiving user query information to generate and execute code files, the problem of time-consuming and labor-intensive manual recording of teaching videos has been solved, realizing the automated generation of teaching videos, improving efficiency and promoting the widespread dissemination of knowledge.
Patent Information
- Application Number
- CN202411288269.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2026-03-17
AI Technical Summary
Existing methods of manually recording instructional videos require extensive professional knowledge, are time-consuming and labor-intensive, have poor real-time performance, and limit the widespread dissemination of knowledge in professional fields.
By receiving the target query information input by the user, a target code file is generated, and the code file is executed using a code interpreter to output a teaching video. Alternatively, a model can be trained to generate and adjust prompt words to improve the execution success rate of the code file, ultimately generating the target teaching video.
It has enabled the automated generation of teaching videos, improved the efficiency of teaching video generation, and promoted the widespread dissemination of knowledge.
Smart Images

Figure CN121685706A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of interactive technology, and in particular to a method for generating instructional videos, an apparatus for generating instructional videos, an electronic device, and a computer-readable storage medium. Background Technology
[0002] In the field of education, such as mathematics teaching, the existing method of manually recording teaching videos requires extensive professional knowledge, is time-consuming and labor-intensive, and has poor real-time performance. This creates a huge professional barrier to the learning and understanding of professional knowledge and limits the widespread dissemination of this knowledge. Summary of the Invention
[0003] In view of the above problems, a method for generating instructional videos, an apparatus for generating instructional videos, an electronic device, and a computer-readable storage medium are proposed to overcome or at least partially solve the above problems, comprising:
[0004] A method for generating instructional videos, characterized in that the method includes:
[0005] Receive the target query information input by the user;
[0006] Based on the target query information, generate the target code file;
[0007] Based on the target code file, determine and output the target teaching video for the target query information.
[0008] Optionally, generating the target code file based on the target query information includes:
[0009] Retrieve preset system prompts;
[0010] Based on the system prompts and the target query information, a target code file is generated.
[0011] Optionally, generating the target code file based on the system prompt information and the target query information includes:
[0012] Based on the system prompts and the target query information, a first prompt word is generated;
[0013] The first prompt word is input into a preset code model to obtain the target code file output by the code model.
[0014] Optionally, determining and outputting the target instructional video for the target query information based on the target code file includes:
[0015] The code interpreter is invoked to execute the target code file;
[0016] When the code interpreter successfully executes the target code file, the first teaching video output by the code interpreter is output as the target teaching video.
[0017] Optionally, the method further includes:
[0018] When the code interpreter fails to execute the target code file, the first prompt word is adjusted to obtain a second prompt word;
[0019] Input the second prompt word into the code model to obtain the first code file;
[0020] The code interpreter is invoked to execute the first code file, and when the code interpreter successfully executes the first code file, the second teaching video output by the code interpreter is output as the target teaching video.
[0021] Optionally, the method further includes:
[0022] When the code interpreter fails to execute the first code file, if the number of times the code interpreter fails to execute does not exceed a preset number, the second prompt word is adjusted to obtain a third prompt word, and the third prompt word is input into the code model to obtain the second code file;
[0023] If the code interpreter fails to execute the first code file, and the number of times the code interpreter fails to execute exceeds a preset number, the user is notified of a video generation failure.
[0024] Optionally, the code model also outputs target description information, and the step of generating a target teaching video based on the target code file and the target query information includes:
[0025] Based on the target code file and the target description information, render the target teaching video for the target query information.
[0026] Optionally, the method further includes:
[0027] Retrieve multiple query results;
[0028] The multiple query information is input into the first preset model respectively to obtain multiple code files;
[0029] The code interpreter is invoked to execute each code file, and training data is generated based on the execution results and query information.
[0030] The second preset model is trained using the training data to obtain the code model.
[0031] Optionally, the method further includes:
[0032] Based on the execution results of each code file, construct error correction training data;
[0033] The step of training the second preset model using the training data to obtain the code model includes:
[0034] The second preset model is trained using the training data and the error correction training data to obtain the code model.
[0035] Optionally, inputting the plurality of query information into the first preset model includes:
[0036] The query information is generalized so that at least one generalized information is obtained for each query information;
[0037] Input the query information and the generalization information into the first preset model.
[0038] This invention also provides an apparatus for generating instructional videos, the apparatus comprising:
[0039] The input module is used to receive the target query information input by the user;
[0040] The code generation module is used to generate target code files based on the target query information;
[0041] The video generation module is used to determine and output a target teaching video for the target query information based on the target code file.
[0042] Optionally, the code generation module is used to obtain preset system prompt information; and generate a target code file based on the system prompt information and the target query information.
[0043] Optionally, the code generation module is used to generate a first prompt word based on the system prompt information and the target query information; input the first prompt word into a preset code model to obtain the target code file output by the code model.
[0044] Optionally, the video generation module is used to call a code interpreter to execute the target code file; when the code interpreter successfully executes the target code file, the first teaching video output by the code interpreter is output as the target teaching video.
[0045] Optionally, the video generation module is further configured to, when the code interpreter fails to execute the target code file, adjust the first prompt word to obtain a second prompt word; input the second prompt word into the code model to obtain a first code file; call the code interpreter to execute the first code file, and when the code interpreter successfully executes the first code file, output the second teaching video output by the code interpreter as the target teaching video.
[0046] Optionally, the video generation module is further configured to, when the code interpreter fails to execute the first code file, adjust the second prompt word to obtain a third prompt word if the number of times the code interpreter fails to execute does not exceed a preset number, and input the third prompt word into the code model to obtain a second code file; and when the code interpreter fails to execute the first code file if the number of times the code interpreter fails to execute exceeds a preset number, provide the user with video generation failure information.
[0047] Optionally, the code model also outputs target description information, and the video generation module is used to render a target teaching video for the target query information based on the target code file and the target description information.
[0048] Optionally, the device further includes:
[0049] The training module is used to acquire multiple query information; input the multiple query information into a first preset model to obtain multiple code files; call a code interpreter to execute each code file respectively, and generate training data based on the execution results and query information; use the training data to train a second preset model to obtain the code model.
[0050] Optionally, the device further includes:
[0051] The error correction data generation module is used to construct error correction training data based on the execution results of each code file;
[0052] The training module is used to train the second preset model using the training data and the error correction training data to obtain the code model.
[0053] Optionally, the training module is used to generalize each query information to obtain at least one generalized information for each query information; and input the query information and the generalized information into the first preset model.
[0054] This invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the above-described method for generating instructional videos.
[0055] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described method for generating instructional videos.
[0056] The embodiments of the present invention have the following advantages:
[0057] In this embodiment of the invention, target query information input by the user is received; a target code file is generated based on the target query information; and a target teaching video is determined and output based on the target code file. Through this embodiment of the invention, teaching videos can be automatically generated based on user needs, thereby improving the efficiency of teaching video generation and promoting the widespread dissemination of knowledge. Attached Figure Description
[0058] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a flowchart illustrating the steps of a method for generating an instructional video according to an embodiment of the present invention;
[0060] Figure 2 This is a flowchart of another method for generating teaching videos according to an embodiment of the present invention;
[0061] Figure 3 This is a flowchart illustrating the steps involved in generating an instructional video according to an embodiment of the present invention;
[0062] Figure 4 This is a flowchart illustrating the steps of training a model according to an embodiment of the present invention;
[0063] Figure 5 This is a structural block diagram of a teaching video generation device according to an embodiment of the present invention. Detailed Implementation
[0064] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0065] Reference Figure 1 , refer to Figure 1 The flowchart illustrating a method for generating an instructional video according to an embodiment of the present invention includes the following steps:
[0066] Step 101: Receive the target query information input by the user.
[0067] In practical applications, when a user wants to obtain a target teaching video, they can first input target query information into the system. This target query information can be used to represent the user's needs. The target query information may include: the content to be explained by the target teaching video, the way it is explained, the duration of the explanation, etc. This embodiment of the invention does not limit this.
[0068] Step 102: Generate the target code file based on the target query information.
[0069] After receiving the target query information input by the user, the target query information can be analyzed to determine the user's needs; then, based on the user's needs, a corresponding target code file is generated; for example, the target code file can be a Manim code file; a Manim code file refers to Python code written using the Manim library for generating mathematical animations. Manim is a Python library specifically designed for creating accurate mathematical animations. This embodiment of the invention does not limit the type of target code file.
[0070] Step 103: Based on the target code file, determine and output the target teaching video for the target query information.
[0071] After obtaining the target code file, the target teaching video for the target query information can be determined based on the target code file, and the target teaching video can be output.
[0072] In some feasible embodiments, the system can run the target code file to generate a target teaching video for the target query information; after generating the target teaching video, it can be returned to the user for learning. Compared to manually recording teaching videos, embodiments of the present invention can automatically generate teaching videos based on user needs, thereby improving the efficiency of teaching video generation and promoting the widespread dissemination of knowledge. For example, the target teaching video can be a mathematics teaching video, and embodiments of the present invention do not limit this.
[0073] In other feasible embodiments, the system can invoke a third-party code interpreter to generate the target instructional video and output the target instructional video generated by the third-party code interpreter to the user.
[0074] In this embodiment of the invention, target query information input by the user is received; a target code file is generated based on the target query information; and a target teaching video is determined and output based on the target code file. Through this embodiment of the invention, teaching videos can be automatically generated based on user needs, thereby improving the efficiency of teaching video generation and promoting the widespread dissemination of knowledge.
[0075] Reference Figure 2 The diagram illustrates a flowchart of another method for generating an instructional video according to an embodiment of the present invention, which may include the following steps:
[0076] Step 201: Receive the target query information input by the user.
[0077] In practical applications, when a user wants to obtain a target teaching video, they can first input target query information into the system. This target query information can be used to represent the user's needs. The target query information may include: the content to be explained by the target teaching video, the way it is explained, the duration of the explanation, etc. This embodiment of the invention does not limit this.
[0078] Step 202: Obtain the preset system prompt information.
[0079] In some feasible embodiments, system prompts for code generation can be set in the system beforehand so that the system can determine which tools can be invoked and what type of task is currently being performed. For example, the system prompts may include:
[0080] (1) The types of tasks the system currently needs to solve, the tools the system can use, etc.
[0081] (2) Generate animation information such as layout, duration, and font of the teaching video; this information can be set in advance or input by the user, and this embodiment of the invention does not limit this.
[0082] Step 203: Generate the target code file based on the system prompts and target query information.
[0083] After receiving system prompts and target query information, the system can determine the task type to be executed, the available tools, and other relevant information based on the system prompts. It can also determine the layout, duration, font, and other animation information of the instructional video. Furthermore, the system can determine the user's specific needs for the target instructional video based on the target query information.
[0084] Based on system prompts and target query information, the system can generate corresponding executable target code files.
[0085] In one embodiment of the present invention, step 203 can be implemented by the following sub-steps:
[0086] Sub-step 11: Generate the first suggestion keyword based on the system prompts and target query information;
[0087] In some feasible embodiments, the system can first generate a first prompt word based on system prompts and target query information; for example:
[0088] The system prompt message is as follows:
[0089] “
[0090] Use Manim to create an animation to explain the concept of {query}.
[0091] The requirements are as follows:
[0092] 1.xxxx.
[0093] 2.xxxx.
[0094] Please pay attention to the layout during the process. Text and graphics should not overlap; for example, if the graphic is on the left, then the text should be on the right. Text that has already appeared should be removed promptly. Think step by step, and provide me with the complete code that executes without errors and generates a video longer than 10 seconds.
[0095] The target query information is: ******.
[0096] You can then fill in the target query information "******" into "{query}" to get the first suggestion keyword:
[0097] “
[0098] Use Manim to create an animation to explain the concept of {******}.
[0099] The requirements are as follows:
[0100] 1.xxxx.
[0101] 2.xxxx.
[0102] During the process, please pay attention to the layout. Text and graphics should not overlap; for example, if the graphic is on the left, then the text should be on the right. Text that has already appeared should disappear promptly. Think step by step, and provide me with the complete code so that it executes without errors and generates a video longer than 10 seconds.
[0103] Sub-step 12: Input the first prompt word into the preset code model to obtain the target code file output by the code model.
[0104] After obtaining the first prompt word, it can be input into a pre-deployed code model in the system. The code model can then generate target code files for generating the target instructional video based on the first prompt word. For example, this code model can be pre-trained to have the ability to generate code files for the instructional videos corresponding to the prompt words. The specific training method will be described in subsequent embodiments and will not be repeated here.
[0105] Step 204: Based on the target code file, determine and output the target teaching video for the target query information.
[0106] After obtaining the target code file, the system can determine the target teaching video based on the target query information and output the target teaching video. For example, the target teaching video can be generated automatically by the system, or it can be generated by calling a third-party code interpreter. Specifically:
[0107] In one embodiment of the present invention, step 204 can be implemented in the following manner:
[0108] The code interpreter is invoked to execute the target code file; when the code interpreter successfully executes the target code file, the first teaching video output by the code interpreter is output as the target teaching video.
[0109] A code interpreter is a tool that executes code. It can directly interpret and execute the source code of a high-level programming language and return the result of the code execution.
[0110] In some feasible embodiments, a third-party code interpreter can be invoked to execute the target code file; if the code interpreter successfully generates a video, it indicates that the code interpreter has successfully executed the target code file; at this time, the first teaching video output by the code interpreter can be used as the target teaching video and output to the user.
[0111] In one embodiment of the present invention, the above method may further include the following steps:
[0112] When the code interpreter fails to execute the target code file, the first prompt word is adjusted to obtain the second prompt word; the second prompt word is input into the code model to obtain the first code file; the code interpreter is called to execute the first code file, and when the code interpreter successfully executes the first code file, the second teaching video output by the code interpreter is output as the target teaching video.
[0113] In some feasible embodiments, if the third-party code interpreter fails to execute the target code file, the system can first adjust the first prompt word to obtain a second prompt word; then, the second prompt word can be input into the code model to obtain a second code file.
[0114] Next, we can continue to call a third-party code interpreter to execute the first code file, and when the code interpreter successfully executes the first code file, output the second teaching video as the target teaching video.
[0115] In practical applications, if the code interpreter fails to generate a video, it means that the code interpreter has failed to execute the target code file. In this case, the system can adjust the first prompt word based on the prompt word (i.e., error message) output by the code interpreter to obtain a second prompt word. Then, the second prompt word can be input into the code model.
[0116] For example, when the code interpreter fails to execute the target code file, the output prompt word format is as follows:
[0117] “
[0118] The following is a Manim code snippet, but it fails to execute:
[0119] {code_block}
[0120] The execution error message is: {error_info}
[0121] Please modify the code according to the error message to execute correctly, return the code and provide a text explanation. Here, {code_block} represents the target code file, and {error_info} represents the error message obtained, that is, the reason why the code interpreter failed to execute the target code file.
[0122] In one embodiment of the present invention, the above method may further include the following steps:
[0123] If the code interpreter fails to execute the first code file, and the number of times the code interpreter fails to execute is less than a preset number, the second prompt word is adjusted to obtain a third prompt word, which is then input into the code model to obtain the second code file. If the number of times the code interpreter fails to execute the first code file exceeds a preset number, the user is notified of a video generation failure.
[0124] In some feasible embodiments, the number of repetitions can be set; specifically, when the code interpreter fails to execute the first code file, if the number of times the code interpreter fails to execute does not exceed the preset number, the second prompt word can be adjusted to obtain the third prompt word, and the third prompt word can be input into the code model to obtain the second code file, and then the code interpreter can be called to execute the second code file.
[0125] In other feasible embodiments, if the code interpreter fails to execute the first code file, and the number of times the code interpreter fails to execute exceeds a preset number, it can be determined that it cannot continue to retry; at this time, the user can be informed of the video generation failure information to inform the user that the target teaching video cannot be generated.
[0126] In one embodiment of the present invention, step 204 can also be implemented in the following manner:
[0127] The code model also outputs target description information, and based on the target code file and target description information, renders target teaching videos for the target query information.
[0128] In some feasible embodiments, in addition to outputting the target code file, the code model can also output target description information for the target code file; this target description information can be used to interpret the target code file or displayed as subtitle information in the video.
[0129] After obtaining the target description information and the target code file, the system can perform rendering operations based on the target code file and the target description information to obtain the target teaching video for the target query information.
[0130] In one embodiment of the present invention, the code model can be trained in the following manner:
[0131] Obtain multiple query information; input the multiple query information into the first preset model to obtain multiple code files; call the code interpreter to execute each code file, and generate training data based on the execution results and query information; use the training data to train the second preset model to obtain the code model.
[0132] In some feasible embodiments, multiple query information can be collected first according to different categories of teaching questions; then, the query information can be input into a first preset model. The first preset model can generate multiple code files for each query information; these code files can be Manim code.
[0133] After obtaining multiple code files for each query, each code file can be executed using a code interpreter; based on whether the execution is successful or not, the execution results of each code file can be generated.
[0134] After obtaining the execution results of each code file, training data can be generated based on the execution results and query information. Specifically, if only one code file among the execution results of multiple code files corresponding to a query is successfully executed, the query information can be directly labeled based on that code file.
[0135] As another example, if at least two of the code files corresponding to a query result in successful execution, the query can be annotated manually.
[0136] After annotation, multiple labeled query results are obtained; these labeled query results can be used to form training data. After obtaining the training data, a pre-set second model can be trained to obtain the code model.
[0137] In some feasible embodiments, the first preset model and the second preset model can be the same model or two different models, and the embodiments of the present invention do not limit this.
[0138] In one embodiment of the present invention, the above method may further include the following steps:
[0139] Based on the execution results of each code file, construct error correction training data;
[0140] In some feasible embodiments, error correction training data can also be constructed based on the execution results of code files. Specifically, if the execution result is a failure, a corresponding code file that can be executed correctly can be set for the query information corresponding to the code file. The query information is then labeled based on the code file that can be executed correctly, thereby obtaining error correction training data.
[0141] The training of the second preset model can be achieved through the following sub-steps:
[0142] Sub-step 21: Use the training data and error correction training data to train the second preset model to obtain the code model.
[0143] After obtaining the error correction training data, the second preset model can be trained using the training data and the error correction training data to obtain the code model.
[0144] In one embodiment of the present invention, when inputting multiple query information into a first preset model, the following sub-steps can be used:
[0145] Sub-step 31: Generalize each query information to obtain at least one generalized information for each query information.
[0146] In some feasible embodiments, to improve the conversion capability of the code model, after collecting multiple query information, each query information can be generalized first; specifically, the query information can be input into a third preset model to obtain at least one generalized information corresponding to the query information. Here, generalized information can refer to information that is semantically similar to the query information but expressed differently.
[0147] For example, generalization can refer to transforming query information into a more generalized and abstract form to better adapt to different application scenarios or improve the generalization ability of a model. The generalization process typically involves the following aspects:
[0148] Remove specific details: When generalizing query information, you can remove some details that are specific to a certain scenario or instance to make the data more general.
[0149] Abstraction: Abstracting specific instances in query information into more general concepts or categories.
[0150] Standardization: Standardizing query information to make it conform to a certain format or range.
[0151] Data augmentation: Increasing the diversity of information by generating new instances of information.
[0152] Feature selection: Select features that have a significant impact on the model's generalization ability and remove irrelevant or redundant features.
[0153] Sub-step 32: Input the query information and generalization information into the first preset model.
[0154] After obtaining the generalization information, the query information and generalization information can be input into the first preset model to obtain at least one corresponding code file.
[0155] In this embodiment of the invention, the system receives target query information input by the user; obtains preset system prompt information; generates a target code file based on the system prompt information and the target query information; and determines and outputs a target teaching video based on the target query information according to the target code file. Through this embodiment of the invention, teaching videos can be automatically generated based on user needs, thereby improving the efficiency of teaching video generation and promoting the widespread dissemination of knowledge.
[0156] The following is a combination of Figure 3 and Figure 4 The above method will be further explained as follows:
[0157] like Figure 3 As shown:
[0158] (1.1) Prompt word generation: Receive the target query information input by the user, and concatenate the target query information with the system prompt information, and input it as the first prompt word into the preset code model;
[0159] (1.2) Code generation: The code model generates target description information and target code file based on the first prompt word. The target code file is preprocessed and saved as an executable Python file.
[0160] (1.3) Code execution and error correction: The code interpreter executes the target code file saved in step (1.2); if the execution is successful, it outputs a prompt text and the target teaching video; otherwise, it regenerates the code in step (1.2) based on the error message and the target code file.
[0161] (1.4) If the code interpreter fails to execute but does not exceed the preset number of times, repeat steps (1.2) and (1.3); if the execution fails and exceeds the preset number of times, provide the user with video generation failure information.
[0162] Next, we will introduce the specific implementation process of the first round of interaction from user query to the generation of the target teaching video.
[0163] Relevant definitions:
[0164] I. System prompts for defining code models
[0165] Configure system suggestions for code generation, including:
[0166] (2.1) Specify the types of tasks that the large code model needs to solve, the tools that can be used, etc.
[0167] (2.2.) Generate animation information such as layout, duration, and font for the teaching video.
[0168] Specific implementation process:
[0169] II. Construction of the first prompt word:
[0170] (3.1) Construct the first prompt word of the code model based on the system prompt information and the target query information. The following is an example.
[0171] (3.2) Example of system prompt message:
[0172] “
[0173] Use Manim to create an animation to explain the concept of {query}.
[0174] The requirements are as follows:
[0175] 1.xxxx.
[0176] 2.xxxx.
[0177] Please pay attention to the layout during the process. Text and graphics should not overlap; for example, if the graphic is on the left, then the text should be on the right. Text that has already appeared should be removed promptly. Think step by step, and provide me with the complete code that executes without errors and generates a video longer than 10 seconds.
[0178] (3.3) Fill the target query information into the {query} field to obtain the first suggestion word.
[0179] III. Code Model: Code Generation and Preprocessing
[0180] (4.1) The content generated by the code model includes two main parts: target description information and target code file.
[0181] (4.2) Preprocess the generated content to obtain the target code file, and save the preprocessed target code file to a local Python file according to the class name.
[0182] IV. Code execution, error correction, and repeated generation:
[0183] (5.1) Start the code interpreter and run the local Python file saved in the previous step, that is, the target code file saved locally.
[0184] (5.2) If the code executes successfully, it will return the target instructional video at the specified path.
[0185] (5.3) Otherwise, the code interpreter returns an error message; the system can reconstruct the prompt word based on the target code file and the error message, and repeat steps 5.2 and 5.3. When the code interpreter fails to execute the first code file, the output prompt word format is as follows:
[0186] “
[0187] The following is a Manim code snippet, but it fails to execute:
[0188] {code_block}
[0189] The execution error message is: {error_info}
[0190] Please modify the code according to the error message to execute correctly, return the code and provide a text explanation. Here, {code_block} represents the first code file, and {error_info} represents the error message obtained, that is, the reason why the code interpreter failed to execute the first code file.
[0191] (5.4) If the execution fails within the specified number of attempts, return a text message to inform the user.
[0192] Next, we will continue to introduce the code model training process, such as... Figure 4 As shown:
[0193] (6.1) First, collect query information according to different categories of teaching problems, and generalize the query information based on the third preset model;
[0194] (6.2) Based on the first preset model, generate n (n>1) code files (i.e. Manim code) for each data obtained in step (6.1);
[0195] (6.3) Execute the n Manim codes obtained in step (6.2) using a code interpreter. Combine the code execution results with manual annotations to select one correctly executed code file for each query as a training label. At the same time, for the code files that execute incorrectly, we construct error correction training data based on this code file and the error information.
[0196] (6.4) Using the training data of “query information (or generalized information) - label” obtained in step (6.3) and the error correction training data, fine-tune the second preset model to obtain the code model for generating teaching videos.
[0197] Next, we will introduce the specific implementation process of the training process.
[0198] Specific implementation process:
[0199] 1. Data collection and generalization
[0200] (7.1) Based on online and website data, query information is collected manually and classified according to teaching questions; the teaching questions can be mathematical questions.
[0201] (7.2) For each type of question, use the third preset model to generate generalized information that is semantically similar to the existing query information but has a different expression.
[0202] 2. Tag code generation
[0203] (7.1) Use the first preset model to generate n Manim codes for each query.
[0204] 3. Tag code filtering
[0205] (8.1) Use a code interpreter to execute the n code files generated for each query and generalization information, and record the execution results.
[0206] (8.2) Based on the results of each code file execution (success or failure, output video) and manual quality inspection, select one correct code as a label.
[0207] (8.3) Modify the correct code file as the label to construct error correction training data based on the query information (or generalization information) corresponding to the code file with the execution error.
[0208] 4. Large-scale code model training
[0209] (9.1) Fine-tune the data format of the “query information (or generalized information) - label” data alignment instructions obtained in steps 8.2 and 8.3, and use it as training data.
[0210] (9.2) Based on the base code model (i.e. the second preset model), fine-tune the instructions for code generation and code correction to obtain a code model that can be used to generate teaching videos.
[0211] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0212] Reference Figure 5 The diagram shows a structural schematic of a teaching video generation device according to an embodiment of the present invention, which may include the following modules:
[0213] Input module 501 is used to receive target query information input by the user;
[0214] The code generation module 502 is used to generate target code files based on the target query information;
[0215] The video generation module 503 is used to determine and output the target teaching video for the target query information based on the target code file.
[0216] In an optional embodiment of the present invention, the code generation module 502 is used to obtain preset system prompt information and generate a target code file based on the system prompt information and target query information.
[0217] In an optional embodiment of the present invention, the code generation module 502 is used to generate a first prompt word based on system prompt information and target query information; input the first prompt word into a preset code model to obtain the target code file output by the code model.
[0218] In an optional embodiment of the present invention, the video generation module 503 is used to call a code interpreter to execute a target code file; when the code interpreter successfully executes the target code file, the first teaching video output by the code interpreter is output as the target teaching video.
[0219] In an optional embodiment of the present invention, the video generation module 503 is further configured to adjust the first prompt word to obtain a second prompt word when the code interpreter fails to execute the target code file; input the second prompt word into the code model to obtain a first code file; call the code interpreter to execute the first code file; and output the second teaching video output by the code interpreter as the target teaching video when the code interpreter successfully executes the first code file.
[0220] In an optional embodiment of the present invention, the video generation module 503 is further configured to, when the code interpreter fails to execute the first code file, adjust the second prompt word to obtain a third prompt word if the number of times the code interpreter fails to execute does not exceed a preset number, and input the third prompt word into the code model to obtain the second code file; and when the code interpreter fails to execute the first code file, if the number of times the code interpreter fails to execute exceeds a preset number, provide the user with video generation failure information.
[0221] In an optional embodiment of the present invention, the code model also outputs target description information, and the video generation module 503 is used to render a target teaching video for the target query information based on the target code file and the target description information.
[0222] In an optional embodiment of the present invention, the apparatus further includes:
[0223] The training module is used to acquire multiple query information; input the multiple query information into the first preset model to obtain multiple code files; call the code interpreter to execute each code file respectively, and generate training data based on the execution results and query information; use the training data to train the second preset model to obtain the code model.
[0224] In an optional embodiment of the present invention, the apparatus further includes:
[0225] The error correction data generation module is used to construct error correction training data based on the execution results of each code file;
[0226] The training module is used to train the second preset model using training data and error correction training data to obtain the code model.
[0227] In an optional embodiment of the present invention, a training module is used to generalize each query information to obtain at least one generalized information for each query information; and input the query information and the generalized information into a first preset model.
[0228] In this embodiment of the invention, target query information input by the user is received; a target code file is generated based on the target query information; and a target teaching video is determined and output based on the target code file. Through this embodiment of the invention, teaching videos can be automatically generated based on user needs, thereby improving the efficiency of teaching video generation and promoting the widespread dissemination of knowledge.
[0229] This invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the above-described method for generating instructional videos.
[0230] This invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, it implements the above-described method for generating instructional videos.
[0231] As the apparatus embodiment is basically similar to the method embodiment, it is described in a relatively simple manner. For relevant details, please refer to the description of the method embodiment.
[0232] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0233] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0234] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0235] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0236] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0237] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0238] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0239] The above provides a detailed description of a method for generating teaching videos, a device for generating teaching videos, an electronic device, and a computer-readable storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for generating a teaching video, characterized by, The method comprises: receiving target query information input by a user; generating a target code file according to the target query information; determining and outputting a target teaching video for the target query information according to the target code file.
2. The method of claim 1, wherein, The generating of the target code file according to the target query information comprises: obtaining preset system prompt information; generating a target code file according to the system prompt information and the target query information.
3. The method of claim 2, wherein, The generating of the target code file according to the system prompt information and the target query information comprises: generating a first prompt word according to the system prompt information and the target query information; inputting the first prompt word into a preset code model to obtain a target code file output by the code model.
4. The method of claim 3, wherein, The determining and outputting of the target teaching video for the target query information according to the target code file comprises: calling a code interpreter to execute the target code file; when the code interpreter successfully executes the target code file, outputting a first teaching video output by the code interpreter as the target teaching video.
5. The method of claim 4, wherein, The method further comprises: when the code interpreter fails to execute the target code file, adjusting the first prompt word to obtain a second prompt word; inputting the second prompt word into the code model to obtain a first code file; calling the code interpreter to execute the first code file, and when the code interpreter successfully executes the first code file, outputting a second teaching video output by the code interpreter as the target teaching video.
6. The method of claim 5, wherein, The method further comprises: when the code interpreter fails to execute the first code file, if the number of times of failure of the code interpreter does not exceed a preset number of times, adjusting the second prompt word to obtain a third prompt word, and inputting the third prompt word into the code model to obtain a second code file; when the code interpreter fails to execute the first code file, if the number of times of failure of the code interpreter exceeds the preset number of times, feeding back video generation failure information to the user.
7. The method of claim 3, wherein, The code model further outputs target description information, and the generating of the target teaching video for the target query information according to the target code file comprises: rendering a target teaching video for the target query information according to the target code file and the target description information.
8. The method of claim 3, wherein, The method further comprises: obtaining a plurality of query information; inputting the plurality of query information into a first preset model respectively to obtain a plurality of code files; calling a code interpreter to execute each code file respectively, and generating training data based on the execution result and the query information; training a second preset model using the training data to obtain the code model.
9. The method of claim 8, wherein, The method further comprises: constructing error correction training data according to the execution result of each code file; The training of the second preset model using the training data to obtain the code model comprises: training the second preset model using the training data and the error correction training data to obtain the code model.
10. The method of claim 8, wherein, The inputting the plurality of query information into the first preset model respectively comprises: generalizing each query information to obtain at least one generalized information for each query information; inputting the query information and the generalized information into the first preset model.
11. An apparatus for generating a teaching video, the apparatus comprising: The device comprises: an input module configured to receive target query information input by a user; a code generation module configured to generate a target code file according to the target query information; a video generation module configured to determine and output a target teaching video for the target query information according to the target code file.
12. An electronic device, comprising: The computer program is stored on the memory and executable on the processor, and when executed by the processor, implements the teaching video generation method of any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium and executable on the processor, and when executed by the processor, implements the teaching video generation method of any one of claims 1 to 10.