Skip to content

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

feat: optimize code

harrydfa8328bb0fb
diff --git a/webui/Main.py b/webui/Main.py
index 357ea45e..22be7abf 100644
--- a/webui/Main.py
+++ b/webui/Main.py
@@ -57,6 +57,16 @@ i18n_dir = os.path.join(root_dir, "webui", "i18n")
config_file = os.path.join(root_dir, "webui", ".streamlit", "webui.toml")
system_locale = utils.get_system_locale()
+
+if "video_subject" not in st.session_state:
+ st.session_state["video_subject"] = ""
+if "video_script" not in st.session_state:
+ st.session_state["video_script"] = ""
+if "video_terms" not in st.session_state:
+ st.session_state["video_terms"] = ""
+if "ui_language" not in st.session_state:
+ st.session_state["ui_language"] = config.ui.get("language", system_locale)
+
# 加载语言文件
locales = utils.load_locales(i18n_dir)
@@ -97,16 +107,6 @@ support_locales = [
"th-TH",
]
-if "video_subject" not in st.session_state:
- st.session_state["video_subject"] = ""
-if "video_script" not in st.session_state:
- st.session_state["video_script"] = ""
-if "video_terms" not in st.session_state:
- st.session_state["video_terms"] = ""
-if "ui_language" not in st.session_state:
- st.session_state["ui_language"] = config.ui.get("language", system_locale)
-
-
def get_all_fonts():
fonts = []
for root, dirs, files in os.walk(font_dir):