Update app.py
Browse files
app.py
CHANGED
|
@@ -376,23 +376,24 @@ with gr.Blocks(
|
|
| 376 |
)
|
| 377 |
|
| 378 |
# 下载元数据
|
| 379 |
-
|
| 380 |
-
fn=
|
| 381 |
-
inputs=[
|
| 382 |
-
|
| 383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
)
|
| 385 |
|
| 386 |
# 设置文件下载(通过返回值触发)
|
| 387 |
-
|
| 388 |
-
fn=lambda img_bytes, meta_bytes, img_name, meta_name: (
|
| 389 |
-
gr.File(value=io.BytesIO(img_bytes), label=img_name, visible=True),
|
| 390 |
-
gr.File(value=io.BytesIO(meta_bytes), label=meta_name, visible=True)
|
| 391 |
-
),
|
| 392 |
-
inputs=[hidden_img_file, hidden_meta_file, hidden_img_file, hidden_meta_file],
|
| 393 |
-
outputs=[hidden_img_file, hidden_meta_file]
|
| 394 |
-
)
|
| 395 |
-
|
| 396 |
# ======================
|
| 397 |
# 启动
|
| 398 |
# ======================
|
|
|
|
| 376 |
)
|
| 377 |
|
| 378 |
# 下载元数据
|
| 379 |
+
generate_btn.click(
|
| 380 |
+
fn=generate_image,
|
| 381 |
+
inputs=[
|
| 382 |
+
prompt_input, negative_prompt_input, style_radio,
|
| 383 |
+
seed_input, width_input, height_input,
|
| 384 |
+
optional_lora_dropdown, lora_scale_slider,
|
| 385 |
+
steps_slider, cfg_slider
|
| 386 |
+
],
|
| 387 |
+
outputs=[
|
| 388 |
+
image_output,
|
| 389 |
+
metadata_output,
|
| 390 |
+
hidden_img_file, # 👈 更新隐藏文件组件(Gradio 自动处理下载)
|
| 391 |
+
hidden_meta_file, # 👈
|
| 392 |
+
]
|
| 393 |
)
|
| 394 |
|
| 395 |
# 设置文件下载(通过返回值触发)
|
| 396 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
# ======================
|
| 398 |
# 启动
|
| 399 |
# ======================
|