利用 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
feat: support reading subtitle position from config file
duchangyu3be3c4a98f16
diff --git a/app/models/schema.py b/app/models/schema.pyindex e61504e1..1cecc1d5 100644--- a/app/models/schema.py+++ b/app/models/schema.py@@ -93,7 +93,7 @@ class VideoParams(BaseModel):bgm_volume: Optional[float] = 0.2subtitle_enabled: Optional[bool] = True- subtitle_position: Optional[str] = "bottom" # top, bottom, center+ subtitle_position: Optional[str] = "bottom" # top, bottom, center, customcustom_position: float = 70.0font_name: Optional[str] = "STHeitiMedium.ttc"text_fore_color: Optional[str] = "#FFFFFF"diff --git a/config.example.toml b/config.example.tomlindex 5f77f42d..88978e9f 100644--- a/config.example.toml+++ b/config.example.toml@@ -221,3 +221,10 @@ api_key = ""# 是否隐藏日志信息# Whether to hide logs in the UIhide_log = false++# 字幕位置设置 (Subtitle position settings)+# 可选值 (Available values): "top", "center", "bottom", "custom"+# subtitle_position = "custom"+# 自定义位置,表示离顶部的百分比 (0-100),仅当 subtitle_position = "custom" 时生效+# Custom position as percentage from top (0-100), only effective when subtitle_position = "custom"+# custom_position = 70.0diff --git a/webui/Main.py b/webui/Main.pyindex 5863a484..52e6335e 100644--- a/webui/Main.py+++ b/webui/Main.py@@ -886,24 +886,34 @@ with right_panel:(tr("Bottom"), "bottom"),(tr("Custom"), "custom"),]+ saved_subtitle_position = config.ui.get("subtitle_position", "bottom")+ saved_position_index = 2+ for i, (_, pos_value) in enumerate(subtitle_positions):+ if pos_value == saved_subtitle_position:+ saved_position_index = i+ breakselected_index = st.selectbox(tr("Position"),- index=2,+ index=saved_position_index,options=range(len(subtitle_positions)),format_func=lambda x: subtitle_positions[x][0],)params.subtitle_position = subtitle_positions[selected_index][1]+ config.ui["subtitle_position"] = params.subtitle_positionif params.subtitle_position == "custom":+ saved_custom_position = config.ui.get("custom_position", 70.0)custom_position = st.text_input(tr("Custom Position (% from top)"),- value="70.0",+ value=str(saved_custom_position),key="custom_position_input",)try:params.custom_position = float(custom_position)if params.custom_position < 0 or params.custom_position > 100:st.error(tr("Please enter a value between 0 and 100"))+ else:+ config.ui["custom_position"] = params.custom_positionexcept ValueError:st.error(tr("Please enter a valid number"))