利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
optimize code
harryc7c7b4847edd
diff --git a/app/services/llm.py b/app/services/llm.pyindex b13a6701..520a3748 100644--- a/app/services/llm.py+++ b/app/services/llm.py@@ -213,7 +213,7 @@ Generate a script for a video, depending on the subject of the video.final_script = ""logger.info(f"subject: {video_subject}")- logger.debug(f"prompt: \n{prompt}")+ # logger.debug(f"prompt: \n{prompt}")response = _generate_response(prompt=prompt)# Return the generated script@@ -241,6 +241,10 @@ Generate a script for a video, depending on the subject of the video.else:logging.error("gpt returned an empty response")+ # g4f may return an error message+ if final_script and "当日额度已消耗完" in final_script:+ raise ValueError(final_script)+logger.success(f"completed: \n{final_script}")return final_script@@ -273,7 +277,7 @@ Please note that you must use English for generating video search terms; Chinese""".strip()logger.info(f"subject: {video_subject}")- logger.debug(f"prompt: \n{prompt}")+ # logger.debug(f"prompt: \n{prompt}")response = _generate_response(prompt)search_terms = []diff --git a/app/services/task.py b/app/services/task.pyindex 05fbc124..bcbc89cf 100644--- a/app/services/task.py+++ b/app/services/task.py@@ -78,7 +78,11 @@ def start(task_id, params: VideoParams):if sub_maker is None:sm.state.update_task(task_id, state=const.TASK_STATE_FAILED)logger.error(- "failed to generate audio, maybe the network is not available. if you are in China, please use a VPN.")+ """failed to generate audio:+1. check if the language of the voice matches the language of the video script.+2. check if the network is available. If you are in China, it is recommended to use a VPN and enable the global traffic mode.+ """.strip()+ )returnaudio_duration = voice.get_audio_duration(sub_maker)@@ -174,7 +178,6 @@ def start(task_id, params: VideoParams):sm.state.update_task(task_id, state=const.TASK_STATE_COMPLETE, progress=100, **kwargs)return kwargs-# def start_test(task_id, params: VideoParams):# print(f"start task {task_id} \n")# time.sleep(5)diff --git a/app/services/voice.py b/app/services/voice.pyindex 5a9e597c..5474fac9 100644--- a/app/services/voice.py+++ b/app/services/voice.py@@ -1023,7 +1023,6 @@ def parse_voice_name(name: str):def is_azure_v2_voice(voice_name: str):voice_name = parse_voice_name(voice_name)- print(voice_name)if voice_name.endswith("-V2"):return voice_name.replace("-V2", "").strip()return ""