MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / build_image_page

Function build_image_page

app/utils/image_page.py:32–513  ·  view source on GitHub ↗
(
    model_path,
    output_dir,
    run_inference,
    lang=DEFAULT_LANG,
)

Source from the content-addressed store, hash-verified

30
31
32def build_image_page(
33 model_path,
34 output_dir,
35 run_inference,
36 lang=DEFAULT_LANG,
37):
38 # 主布局:左右分栏
39 with gr.Row():
40 # 左侧:配置和输入区域
41 with gr.Column(scale=5):
42 # 模型配置区域
43 with gr.Accordion(t("model_config", lang), open=True, elem_classes=["model-config"]):
44 gr.Markdown(t("model_config_hint_image", lang))
45 # FP8 支持提示
46 if not is_fp8_supported_gpu():
47 gr.Markdown(t("fp8_not_supported", lang))
48
49 model_path_input = gr.Textbox(value=model_path, visible=False)
50
51 # 任务类型选择(前端显示大写,传递值小写)
52 task_type_input = gr.Radio(
53 label=t("task_type", lang),
54 choices=[("I2I", "i2i"), ("T2I", "t2i")],
55 value="i2i",
56 info=t("task_type_info", lang),
57 elem_classes=["horizontal-radio"],
58 )
59
60 # 模型类型选择(根据任务类型动态更新)
61 model_type_input = gr.Radio(
62 label=t("model_type", lang),
63 choices=["Qwen-Image-Edit-2511"],
64 value="Qwen-Image-Edit-2511",
65 info=t("model_type_info", lang),
66 elem_classes=["horizontal-radio"],
67 )
68
69 download_source_input = gr.Radio(
70 label=t("download_source", lang),
71 choices=(["huggingface", "modelscope"] if (HF_AVAILABLE and MS_AVAILABLE) else (["huggingface"] if HF_AVAILABLE else ["modelscope"] if MS_AVAILABLE else [])),
72 value=("modelscope" if MS_AVAILABLE else ("huggingface" if HF_AVAILABLE else None)),
73 info=t("download_source_info", lang),
74 visible=HF_AVAILABLE or MS_AVAILABLE,
75 elem_classes=["horizontal-radio"],
76 )
77 # 构建 Qwen 模型组件(默认显示)
78 qwen_image_components = build_qwen_image_components(model_path, model_path_input, download_source_input, model_type_input, lang)
79 qwen_image_dit_path_input = qwen_image_components["qwen_image_dit_path_input"]
80 qwen_image_vae_path_input = qwen_image_components["qwen_image_vae_path_input"]
81 qwen_image_scheduler_path_input = qwen_image_components["qwen_image_scheduler_path_input"]
82 qwen25vl_encoder_path_input = qwen_image_components["qwen25vl_encoder_path_input"]
83 qwen_image_dit_download_btn = qwen_image_components["qwen_image_dit_download_btn"]
84 qwen_image_vae_download_btn = qwen_image_components["qwen_image_vae_download_btn"]
85 qwen_image_scheduler_download_btn = qwen_image_components["qwen_image_scheduler_download_btn"]
86 qwen25vl_encoder_download_btn = qwen_image_components["qwen25vl_encoder_download_btn"]
87 qwen_image_use_lora_input = qwen_image_components["use_lora"]
88 qwen_image_lora_path_input = qwen_image_components["lora_path_input"]
89 qwen_image_lora_strength_input = qwen_image_components["lora_strength"]

Callers 1

build_uiFunction · 0.90

Calls 7

tFunction · 0.90
is_fp8_supported_gpuFunction · 0.90
generate_random_seedFunction · 0.70
generate_unique_filenameFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected