from shortGPT.gpt import gpt_utils import json def generateScript(script_description, language): out = {'script': ''} chat, system = gpt_utils.load_local_yaml_prompt('prompt_templates/chat_video_script.yaml') chat = chat.replace("<>", script_description).replace("<>", language) while not ('script' in out and out['script']): try: result = gpt_utils.gpt3Turbo_completion(chat_prompt=chat, system=system, temp=1) out = json.loads(result) except Exception as e: print(e, "Difficulty parsing the output in gpt_chat_video.generateScript") return out['script'] def correctScript(script, correction): out = {'script': ''} chat, system = gpt_utils.load_local_yaml_prompt('prompt_templates/chat_video_edit_script.yaml') chat = chat.replace("<>", script).replace("<>", correction) while not ('script' in out and out['script']): try: result = gpt_utils.gpt3Turbo_completion(chat_prompt=chat, system=system, temp=1) out = json.loads(result) except Exception as e: print("Difficulty parsing the output in gpt_chat_video.generateScript") return out['script']