Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -585,29 +585,28 @@ with gr.Blocks(title="D-REX Studio") as app:
|
|
| 585 |
elem_id="history-display",
|
| 586 |
)
|
| 587 |
clear_history_btn = gr.Button("Clear history", size="sm", variant="secondary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
|
| 589 |
-
|
| 590 |
-
custom_lora_input = gr.Textbox(
|
| 591 |
-
label="HuggingFace repo",
|
| 592 |
-
placeholder="username/lora-model-name",
|
| 593 |
-
show_label=True,
|
| 594 |
-
)
|
| 595 |
-
gr.Markdown("[Browse Qwen-Image LoRAs โ](https://huggingface.co/models?other=base_model:adapter:Qwen/Qwen-Image)")
|
| 596 |
-
custom_lora_info = gr.HTML(visible=False)
|
| 597 |
-
custom_lora_remove = gr.Button("Remove custom LoRA", visible=False, size="sm", variant="secondary")
|
| 598 |
-
output_tool_img = gr.Image(label="Result")
|
| 599 |
-
|
| 600 |
-
with gr.Tab("Image Tools"):
|
| 601 |
with gr.Row():
|
| 602 |
input_tool_img = gr.Image(label="Upload Image for Tools", type="pil")
|
| 603 |
-
|
| 604 |
with gr.Row():
|
| 605 |
upscale_btn = gr.Button("๐ Upscale (2x)", variant="secondary")
|
| 606 |
face_swap_btn = gr.Button("๐ญ Face Swap", variant="secondary")
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
|
|
|
| 611 |
|
| 612 |
with gr.Row():
|
| 613 |
prompt = gr.Textbox(
|
|
@@ -631,7 +630,7 @@ with gr.Blocks(title="D-REX Studio") as app:
|
|
| 631 |
meta_panel = gr.HTML(
|
| 632 |
"<div></div>",
|
| 633 |
elem_id="meta-panel",
|
| 634 |
-
visible=True,
|
| 635 |
)
|
| 636 |
|
| 637 |
with gr.Row():
|
|
@@ -715,6 +714,19 @@ with gr.Blocks(title="D-REX Studio") as app:
|
|
| 715 |
lambda: ([], "<div style='font-size:11px;font-family:monospace;color:#524e4a;padding:12px;text-align:center'>history cleared</div>"),
|
| 716 |
outputs=[history_state, history_html],
|
| 717 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
|
| 719 |
# โโ LAUNCH โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 720 |
|
|
|
|
| 585 |
elem_id="history-display",
|
| 586 |
)
|
| 587 |
clear_history_btn = gr.Button("Clear history", size="sm", variant="secondary")
|
| 588 |
+
with gr.Tab("Custom LoRA"):
|
| 589 |
+
custom_lora_input = gr.Textbox(
|
| 590 |
+
label="HuggingFace repo",
|
| 591 |
+
placeholder="username/lora-model-name",
|
| 592 |
+
show_label=True,
|
| 593 |
+
)
|
| 594 |
+
gr.Markdown("[Browse Qwen-Image LoRAs โ](https://huggingface.co/models?other=base_model:adapter:Qwen/Qwen-Image)")
|
| 595 |
+
custom_lora_info = gr.HTML(visible=False)
|
| 596 |
+
custom_lora_remove = gr.Button("Remove custom LoRA", visible=False, size="sm", variant="secondary")
|
| 597 |
|
| 598 |
+
with gr.Tab("Image Tools"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
with gr.Row():
|
| 600 |
input_tool_img = gr.Image(label="Upload Image for Tools", type="pil")
|
| 601 |
+
|
| 602 |
with gr.Row():
|
| 603 |
upscale_btn = gr.Button("๐ Upscale (2x)", variant="secondary")
|
| 604 |
face_swap_btn = gr.Button("๐ญ Face Swap", variant="secondary")
|
| 605 |
+
|
| 606 |
+
output_tool_img = gr.Image(label="Result")
|
| 607 |
+
|
| 608 |
+
# โโ RIGHT PANEL โโ
|
| 609 |
+
with gr.Column(scale=5):
|
| 610 |
|
| 611 |
with gr.Row():
|
| 612 |
prompt = gr.Textbox(
|
|
|
|
| 630 |
meta_panel = gr.HTML(
|
| 631 |
"<div></div>",
|
| 632 |
elem_id="meta-panel",
|
| 633 |
+
visible=True,
|
| 634 |
)
|
| 635 |
|
| 636 |
with gr.Row():
|
|
|
|
| 714 |
lambda: ([], "<div style='font-size:11px;font-family:monospace;color:#524e4a;padding:12px;text-align:center'>history cleared</div>"),
|
| 715 |
outputs=[history_state, history_html],
|
| 716 |
)
|
| 717 |
+
|
| 718 |
+
# โโ IMAGE TOOLS LOGIC (เฎเฎเฏเฎเฏ เฎชเฏเฎธเฏเฎเฏ เฎเฏเฎฏเฏเฎฏเฎตเฏเฎฎเฏ) โโ
|
| 719 |
+
def simple_upscale(img):
|
| 720 |
+
if img is None: return None
|
| 721 |
+
width, height = img.size
|
| 722 |
+
# LANCZOS เฎฐเฏเฎเฏเฎเฎฟเฎเฏ เฎเฎฎเฏเฎเฏ เฎเฏเฎตเฎพเฎฒเฎฟเฎเฏเฎเฎฟเฎฏเฏ เฎเฎฐเฎณเฎตเฎฟเฎฑเฏเฎเฏ เฎจเฎฉเฏเฎฑเฎพเฎ เฎตเฏเฎคเฏเฎคเฎฟเฎฐเฏเฎเฏเฎเฏเฎฎเฏ
|
| 723 |
+
return img.resize((width * 2, height * 2), Image.LANCZOS)
|
| 724 |
+
|
| 725 |
+
upscale_btn.click(
|
| 726 |
+
fn=simple_upscale,
|
| 727 |
+
inputs=[input_tool_img],
|
| 728 |
+
outputs=[output_tool_img]
|
| 729 |
+
)
|
| 730 |
|
| 731 |
# โโ LAUNCH โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 732 |
|