Update app.py
Browse files
app.py
CHANGED
|
@@ -427,12 +427,16 @@ with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
|
|
| 427 |
run_button = gr.Button("✨ Edit Image", variant="primary", size="lg")
|
| 428 |
|
| 429 |
with gr.Column():
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
|
| 437 |
with gr.Accordion("➕ Extra LoRAs (optional)", open=False):
|
| 438 |
with gr.Row():
|
|
@@ -493,6 +497,19 @@ with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
|
|
| 493 |
outputs=[prompt],
|
| 494 |
)
|
| 495 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 496 |
if __name__ == "__main__":
|
| 497 |
demo.queue(max_size=30).launch(
|
| 498 |
mcp_server=True, ssr_mode=False, show_error=True
|
|
|
|
| 427 |
run_button = gr.Button("✨ Edit Image", variant="primary", size="lg")
|
| 428 |
|
| 429 |
with gr.Column():
|
| 430 |
+
with gr.Column():
|
| 431 |
+
output_image = gr.Image(
|
| 432 |
+
label="Output",
|
| 433 |
+
interactive=False,
|
| 434 |
+
format="png",
|
| 435 |
+
elem_classes=["contain-preview"],
|
| 436 |
+
)
|
| 437 |
+
with gr.Row():
|
| 438 |
+
use_as_input_btn = gr.Button("↻ Use as Input", size="sm", variant="secondary")
|
| 439 |
+
clear_output_btn = gr.Button("✕ Clear", size="sm", variant="secondary")
|
| 440 |
|
| 441 |
with gr.Accordion("➕ Extra LoRAs (optional)", open=False):
|
| 442 |
with gr.Row():
|
|
|
|
| 497 |
outputs=[prompt],
|
| 498 |
)
|
| 499 |
|
| 500 |
+
# ── Output image actions ─────────────────────────────────────────────────
|
| 501 |
+
use_as_input_btn.click(
|
| 502 |
+
fn=lambda img: img,
|
| 503 |
+
inputs=[output_image],
|
| 504 |
+
outputs=[input_image],
|
| 505 |
+
)
|
| 506 |
+
|
| 507 |
+
clear_output_btn.click(
|
| 508 |
+
fn=lambda: gr.update(value=None),
|
| 509 |
+
inputs=None,
|
| 510 |
+
outputs=[output_image],
|
| 511 |
+
)
|
| 512 |
+
|
| 513 |
if __name__ == "__main__":
|
| 514 |
demo.queue(max_size=30).launch(
|
| 515 |
mcp_server=True, ssr_mode=False, show_error=True
|