模板中媒体尺寸改为预置方案
This commit is contained in:
61
web/app.py
61
web/app.py
@@ -782,6 +782,11 @@ def main():
|
||||
generator_for_params = HTMLFrameGenerator(template_path_for_params)
|
||||
custom_params_for_video = generator_for_params.parse_template_parameters()
|
||||
|
||||
# Get media size from template (for image/video generation)
|
||||
media_width, media_height = generator_for_params.get_media_size()
|
||||
st.session_state['template_media_width'] = media_width
|
||||
st.session_state['template_media_height'] = media_height
|
||||
|
||||
# Detect template media type
|
||||
from pathlib import Path
|
||||
template_name = Path(frame_template).name
|
||||
@@ -1023,43 +1028,18 @@ def main():
|
||||
else:
|
||||
workflow_key = "runninghub/image_flux.json" # fallback
|
||||
|
||||
# Get media size from template
|
||||
image_width = st.session_state.get('template_media_width', 1024)
|
||||
image_height = st.session_state.get('template_media_height', 1024)
|
||||
|
||||
# Display media size info (read-only)
|
||||
if template_media_type == "video":
|
||||
size_info_text = tr('style.video_size_info', width=image_width, height=image_height)
|
||||
else:
|
||||
size_info_text = tr('style.image_size_info', width=image_width, height=image_height)
|
||||
st.info(f"📐 {size_info_text}")
|
||||
|
||||
# 2. Media size input
|
||||
col1, col2 = st.columns(2)
|
||||
with col1:
|
||||
if template_media_type == "video":
|
||||
width_label = tr('style.video_width')
|
||||
width_help = tr('style.video_width_help')
|
||||
else:
|
||||
width_label = tr('style.image_width')
|
||||
width_help = tr('style.image_width_help')
|
||||
|
||||
image_width = st.number_input(
|
||||
width_label,
|
||||
min_value=128,
|
||||
value=1024,
|
||||
step=1,
|
||||
label_visibility="visible",
|
||||
help=width_help
|
||||
)
|
||||
with col2:
|
||||
if template_media_type == "video":
|
||||
height_label = tr('style.video_height')
|
||||
height_help = tr('style.video_height_help')
|
||||
else:
|
||||
height_label = tr('style.image_height')
|
||||
height_help = tr('style.image_height_help')
|
||||
|
||||
image_height = st.number_input(
|
||||
height_label,
|
||||
min_value=128,
|
||||
value=1024,
|
||||
step=1,
|
||||
label_visibility="visible",
|
||||
help=height_help
|
||||
)
|
||||
|
||||
# 3. Prompt prefix input
|
||||
# Prompt prefix input
|
||||
# Get current prompt_prefix from config
|
||||
current_prefix = comfyui_config["image"]["prompt_prefix"]
|
||||
|
||||
@@ -1152,10 +1132,12 @@ def main():
|
||||
st.info("ℹ️ " + tr("image.not_required"))
|
||||
st.caption(tr("image.not_required_hint"))
|
||||
|
||||
# Get media size from template (even though not used, for consistency)
|
||||
image_width = st.session_state.get('template_media_width', 1024)
|
||||
image_height = st.session_state.get('template_media_height', 1024)
|
||||
|
||||
# Set default values for later use
|
||||
workflow_key = None
|
||||
image_width = 1024
|
||||
image_height = 1024
|
||||
prompt_prefix = ""
|
||||
|
||||
|
||||
@@ -1225,14 +1207,13 @@ def main():
|
||||
progress_bar.progress(min(int(event.progress * 100), 99)) # Cap at 99% until complete
|
||||
|
||||
# Generate video (directly pass parameters)
|
||||
# Note: image_width and image_height are now auto-determined from template
|
||||
video_params = {
|
||||
"text": text,
|
||||
"mode": mode,
|
||||
"title": title if title else None,
|
||||
"n_scenes": n_scenes,
|
||||
"image_workflow": workflow_key,
|
||||
"image_width": int(image_width),
|
||||
"image_height": int(image_height),
|
||||
"frame_template": frame_template,
|
||||
"prompt_prefix": prompt_prefix,
|
||||
"bgm_path": bgm_path,
|
||||
|
||||
@@ -49,17 +49,8 @@
|
||||
"style.workflow_how": "Place the exported image_xxx.json workflow file(API format) into the workflows/selfhost/ folder (for local ComfyUI) or the workflows/runninghub/ folder (for cloud)",
|
||||
"style.video_workflow_what": "Determines how each frame's video clip is generated and its effect (e.g., using different video generation models)",
|
||||
"style.video_workflow_how": "Place the exported video_xxx.json workflow file(API format) into the workflows/selfhost/ folder (for local ComfyUI) or the workflows/runninghub/ folder (for cloud)",
|
||||
"style.image_size": "Image Size",
|
||||
"style.image_width": "Width",
|
||||
"style.image_height": "Height",
|
||||
"style.image_width_help": "Width of AI-generated images (Note: This is the image size, not the final video size. Video size is determined by the template)",
|
||||
"style.image_height_help": "Height of AI-generated images (Note: This is the image size, not the final video size. Video size is determined by the template)",
|
||||
"style.video_width": "Video Width",
|
||||
"style.video_height": "Video Height",
|
||||
"style.video_width_help": "Width of AI-generated video (Note: This is the video clip size, will auto-adapt to template size)",
|
||||
"style.video_height_help": "Height of AI-generated video (Note: This is the video clip size, will auto-adapt to template size)",
|
||||
"style.image_size_note": "Image size controls the dimensions of AI-generated illustrations, and does not affect the final video size. Video size is determined by the Storyboard Template below.",
|
||||
"style.video_size_note": "Video size will automatically adapt to the template size, no manual adjustment needed.",
|
||||
"style.image_size_info": "Image Size: {width}x{height} (auto-determined by template)",
|
||||
"style.video_size_info": "Video Size: {width}x{height} (auto-determined by template)",
|
||||
"style.prompt_prefix": "Prompt Prefix",
|
||||
"style.prompt_prefix_what": "Automatically added before all image prompts to control the illustration style uniformly (e.g., cartoon, realistic)",
|
||||
"style.prompt_prefix_how": "Enter style description in the input box below. To save permanently, edit the config.yaml file",
|
||||
|
||||
@@ -49,17 +49,8 @@
|
||||
"style.workflow_how": "将导出的 image_xxx.json 工作流文件(API格式)放入 workflows/selfhost/(本地 ComfyUI)或 workflows/runninghub/(云端)文件夹",
|
||||
"style.video_workflow_what": "决定视频中每帧视频片段的生成方式和效果(如使用不同的视频生成模型)",
|
||||
"style.video_workflow_how": "将导出的 video_xxx.json 工作流文件(API格式)放入 workflows/selfhost/(本地 ComfyUI)或 workflows/runninghub/(云端)文件夹",
|
||||
"style.image_size": "图片尺寸",
|
||||
"style.image_width": "宽度",
|
||||
"style.image_height": "高度",
|
||||
"style.image_width_help": "AI 生成插图的宽度(注意:这是插图尺寸,不是最终视频尺寸。视频尺寸由模板决定)",
|
||||
"style.image_height_help": "AI 生成插图的高度(注意:这是插图尺寸,不是最终视频尺寸。视频尺寸由模板决定)",
|
||||
"style.video_width": "视频宽度",
|
||||
"style.video_height": "视频高度",
|
||||
"style.video_width_help": "AI 生成视频的宽度(注意:这是视频片段尺寸,会自适应模板尺寸)",
|
||||
"style.video_height_help": "AI 生成视频的高度(注意:这是视频片段尺寸,会自适应模板尺寸)",
|
||||
"style.image_size_note": "图片尺寸控制 AI 生成的插图大小,不影响最终视频尺寸。视频尺寸由下方的「📐 分镜模板」决定。",
|
||||
"style.video_size_note": "视频尺寸会自动适配模板尺寸,无需手动调整。",
|
||||
"style.image_size_info": "插图尺寸:{width}x{height}(由模板自动决定)",
|
||||
"style.video_size_info": "视频尺寸:{width}x{height}(由模板自动决定)",
|
||||
"style.prompt_prefix": "提示词前缀",
|
||||
"style.prompt_prefix_what": "自动添加到所有图片提示词前面,统一控制插图风格(如:卡通风格、写实风格等)",
|
||||
"style.prompt_prefix_how": "直接在下方输入框填写风格描述。若要永久保存,需编辑 config.yaml 文件",
|
||||
|
||||
Reference in New Issue
Block a user