插图支持自定义尺寸
This commit is contained in:
42
web/app.py
42
web/app.py
@@ -548,6 +548,8 @@ def main():
|
|||||||
st.markdown(tr("style.workflow_what"))
|
st.markdown(tr("style.workflow_what"))
|
||||||
st.markdown(f"**{tr('help.how')}**")
|
st.markdown(f"**{tr('help.how')}**")
|
||||||
st.markdown(tr("style.workflow_how"))
|
st.markdown(tr("style.workflow_how"))
|
||||||
|
st.markdown(f"**{tr('help.note')}**")
|
||||||
|
st.markdown(tr("style.image_size_note"))
|
||||||
|
|
||||||
# Get available workflows from pixelle_video (with source info)
|
# Get available workflows from pixelle_video (with source info)
|
||||||
workflows = pixelle_video.image.list_workflows()
|
workflows = pixelle_video.image.list_workflows()
|
||||||
@@ -583,19 +585,38 @@ def main():
|
|||||||
workflow_key = "runninghub/image_flux.json" # fallback
|
workflow_key = "runninghub/image_flux.json" # fallback
|
||||||
|
|
||||||
|
|
||||||
# 2. Prompt prefix input
|
# 2. Image size input
|
||||||
st.markdown(f"**{tr('style.prompt_prefix')}**")
|
col1, col2 = st.columns(2)
|
||||||
|
with col1:
|
||||||
|
image_width = st.number_input(
|
||||||
|
tr('style.image_width'),
|
||||||
|
min_value=128,
|
||||||
|
value=1024,
|
||||||
|
step=1,
|
||||||
|
label_visibility="visible",
|
||||||
|
help=tr('style.image_width_help')
|
||||||
|
)
|
||||||
|
with col2:
|
||||||
|
image_height = st.number_input(
|
||||||
|
tr('style.image_height'),
|
||||||
|
min_value=128,
|
||||||
|
value=1024,
|
||||||
|
step=1,
|
||||||
|
label_visibility="visible",
|
||||||
|
help=tr('style.image_height_help')
|
||||||
|
)
|
||||||
|
|
||||||
|
# 3. Prompt prefix input
|
||||||
# Get current prompt_prefix from config
|
# Get current prompt_prefix from config
|
||||||
current_prefix = comfyui_config["image"]["prompt_prefix"]
|
current_prefix = comfyui_config["image"]["prompt_prefix"]
|
||||||
|
|
||||||
# Prompt prefix input (temporary, not saved to config)
|
# Prompt prefix input (temporary, not saved to config)
|
||||||
prompt_prefix = st.text_area(
|
prompt_prefix = st.text_area(
|
||||||
"Prompt Prefix",
|
tr('style.prompt_prefix'),
|
||||||
value=current_prefix,
|
value=current_prefix,
|
||||||
placeholder=tr("style.prompt_prefix_placeholder"),
|
placeholder=tr("style.prompt_prefix_placeholder"),
|
||||||
height=80,
|
height=80,
|
||||||
label_visibility="collapsed",
|
label_visibility="visible",
|
||||||
help=tr("style.prompt_prefix_help")
|
help=tr("style.prompt_prefix_help")
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -618,12 +639,12 @@ def main():
|
|||||||
# Build final prompt with prefix
|
# Build final prompt with prefix
|
||||||
final_prompt = build_image_prompt(test_prompt, prompt_prefix)
|
final_prompt = build_image_prompt(test_prompt, prompt_prefix)
|
||||||
|
|
||||||
# Generate preview image (small size for speed)
|
# Generate preview image (use user-specified size)
|
||||||
preview_image_path = run_async(pixelle_video.image(
|
preview_image_path = run_async(pixelle_video.image(
|
||||||
prompt=final_prompt,
|
prompt=final_prompt,
|
||||||
workflow=workflow_key,
|
workflow=workflow_key,
|
||||||
width=512,
|
width=int(image_width),
|
||||||
height=512
|
height=int(image_height)
|
||||||
))
|
))
|
||||||
|
|
||||||
# Display preview (support both URL and local path)
|
# Display preview (support both URL and local path)
|
||||||
@@ -734,6 +755,11 @@ def main():
|
|||||||
# Get full template path
|
# Get full template path
|
||||||
frame_template = template_path_map.get(selected_display_name)
|
frame_template = template_path_map.get(selected_display_name)
|
||||||
|
|
||||||
|
# Display video size from template
|
||||||
|
from pixelle_video.utils.template_util import parse_template_size
|
||||||
|
video_width, video_height = parse_template_size(frame_template)
|
||||||
|
st.caption(tr("template.video_size_info", width=video_width, height=video_height))
|
||||||
|
|
||||||
# Template preview expander
|
# Template preview expander
|
||||||
with st.expander(tr("template.preview_title"), expanded=False):
|
with st.expander(tr("template.preview_title"), expanded=False):
|
||||||
col1, col2 = st.columns(2)
|
col1, col2 = st.columns(2)
|
||||||
@@ -867,6 +893,8 @@ def main():
|
|||||||
"n_scenes": n_scenes,
|
"n_scenes": n_scenes,
|
||||||
"tts_workflow": tts_workflow_key,
|
"tts_workflow": tts_workflow_key,
|
||||||
"image_workflow": workflow_key,
|
"image_workflow": workflow_key,
|
||||||
|
"image_width": int(image_width),
|
||||||
|
"image_height": int(image_height),
|
||||||
"frame_template": frame_template,
|
"frame_template": frame_template,
|
||||||
"prompt_prefix": prompt_prefix,
|
"prompt_prefix": prompt_prefix,
|
||||||
"bgm_path": bgm_path,
|
"bgm_path": bgm_path,
|
||||||
|
|||||||
@@ -45,6 +45,12 @@
|
|||||||
"style.workflow": "Workflow Selection",
|
"style.workflow": "Workflow Selection",
|
||||||
"style.workflow_what": "Determines how each frame's illustration is generated and its effect (e.g., using FLUX, SD models)",
|
"style.workflow_what": "Determines how each frame's illustration is generated and its effect (e.g., using FLUX, SD models)",
|
||||||
"style.workflow_how": "Place image_xxx.json workflow files in workflows/selfhost/ (local ComfyUI) or workflows/runninghub/ (cloud) folder",
|
"style.workflow_how": "Place image_xxx.json workflow files in workflows/selfhost/ (local ComfyUI) or workflows/runninghub/ (cloud) folder",
|
||||||
|
"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.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.prompt_prefix": "Prompt Prefix",
|
"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_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",
|
"style.prompt_prefix_how": "Enter style description in the input box below. To save permanently, edit the config.yaml file",
|
||||||
@@ -68,6 +74,7 @@
|
|||||||
"template.selector": "Template Selection",
|
"template.selector": "Template Selection",
|
||||||
"template.select": "Select Template",
|
"template.select": "Select Template",
|
||||||
"template.select_help": "Select template and video size",
|
"template.select_help": "Select template and video size",
|
||||||
|
"template.video_size_info": "Final Video Size: {width} × {height}",
|
||||||
"template.separator_selected": "Please select a specific template, not the group header",
|
"template.separator_selected": "Please select a specific template, not the group header",
|
||||||
"template.default": "Default",
|
"template.default": "Default",
|
||||||
"template.modern": "Modern",
|
"template.modern": "Modern",
|
||||||
@@ -198,6 +205,7 @@
|
|||||||
"help.feature_description": "💡 Feature Description",
|
"help.feature_description": "💡 Feature Description",
|
||||||
"help.what": "Purpose",
|
"help.what": "Purpose",
|
||||||
"help.how": "Customization",
|
"help.how": "Customization",
|
||||||
|
"help.note": "Note",
|
||||||
|
|
||||||
"language.select": "🌐 Language"
|
"language.select": "🌐 Language"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,12 @@
|
|||||||
"style.workflow": "工作流选择",
|
"style.workflow": "工作流选择",
|
||||||
"style.workflow_what": "决定视频中每帧插图的生成方式和效果(如使用 FLUX、SD 等模型)",
|
"style.workflow_what": "决定视频中每帧插图的生成方式和效果(如使用 FLUX、SD 等模型)",
|
||||||
"style.workflow_how": "将 image_xxx.json 工作流文件放入 workflows/selfhost/(本地 ComfyUI)或 workflows/runninghub/(云端)文件夹",
|
"style.workflow_how": "将 image_xxx.json 工作流文件放入 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.image_size_note": "图片尺寸控制 AI 生成的插图大小,不影响最终视频尺寸。视频尺寸由下方的「📐 分镜模板」决定。",
|
||||||
"style.prompt_prefix": "提示词前缀",
|
"style.prompt_prefix": "提示词前缀",
|
||||||
"style.prompt_prefix_what": "自动添加到所有图片提示词前面,统一控制插图风格(如:卡通风格、写实风格等)",
|
"style.prompt_prefix_what": "自动添加到所有图片提示词前面,统一控制插图风格(如:卡通风格、写实风格等)",
|
||||||
"style.prompt_prefix_how": "直接在下方输入框填写风格描述。若要永久保存,需编辑 config.yaml 文件",
|
"style.prompt_prefix_how": "直接在下方输入框填写风格描述。若要永久保存,需编辑 config.yaml 文件",
|
||||||
@@ -68,6 +74,7 @@
|
|||||||
"template.selector": "模板选择",
|
"template.selector": "模板选择",
|
||||||
"template.select": "选择模板",
|
"template.select": "选择模板",
|
||||||
"template.select_help": "选择模板和视频尺寸",
|
"template.select_help": "选择模板和视频尺寸",
|
||||||
|
"template.video_size_info": "最终视频尺寸:{width} × {height}",
|
||||||
"template.separator_selected": "请选择具体的模板,而不是分组标题",
|
"template.separator_selected": "请选择具体的模板,而不是分组标题",
|
||||||
"template.default": "默认",
|
"template.default": "默认",
|
||||||
"template.modern": "现代",
|
"template.modern": "现代",
|
||||||
@@ -198,6 +205,7 @@
|
|||||||
"help.feature_description": "💡 功能说明",
|
"help.feature_description": "💡 功能说明",
|
||||||
"help.what": "作用",
|
"help.what": "作用",
|
||||||
"help.how": "自定义方式",
|
"help.how": "自定义方式",
|
||||||
|
"help.note": "注意",
|
||||||
|
|
||||||
"language.select": "🌐 语言"
|
"language.select": "🌐 语言"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user