Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -543,7 +543,7 @@ def update_resolution_dropdown(diffusion_enabled, current_resolution_str):
|
|
| 543 |
new_h, new_w = DEFAULT_DIFFUSION_RESOLUTIONS[0]
|
| 544 |
new_value_str = f"{new_h}x{new_w}"
|
| 545 |
return dict(choices=[f'{h}x{w}' for h, w in DEFAULT_DIFFUSION_RESOLUTIONS],
|
| 546 |
-
|
| 547 |
else:
|
| 548 |
new_h, new_w = int(current_h) // 2, int(current_w) // 2
|
| 549 |
|
|
@@ -552,7 +552,7 @@ def update_resolution_dropdown(diffusion_enabled, current_resolution_str):
|
|
| 552 |
new_value_str = f"{new_h}x{new_w}"
|
| 553 |
|
| 554 |
return dict(choices=[f'{h}x{w}' for h, w in DEFAULT_RESOLUTIONS],
|
| 555 |
-
|
| 556 |
|
| 557 |
|
| 558 |
# --- Gradio Layout ---
|
|
@@ -738,6 +738,7 @@ def build_demo(embed_mode):
|
|
| 738 |
label="Output Resolution (HxW)",
|
| 739 |
elem_id="resolution_dropdown",
|
| 740 |
info="Select target size for generated images."
|
|
|
|
| 741 |
)
|
| 742 |
|
| 743 |
llm_cfg_scale = gr.Slider(
|
|
@@ -786,11 +787,11 @@ def build_demo(embed_mode):
|
|
| 786 |
with gr.Row():
|
| 787 |
gr.Examples(examples=[
|
| 788 |
["examples/ImageUnderstandingExample/images/1.png",
|
| 789 |
-
"Depict the image in detail."],
|
| 790 |
-
["examples/ImageUnderstandingExample/images/2.png",
|
| 791 |
"What are they doing?"],
|
|
|
|
|
|
|
| 792 |
["examples/ImageUnderstandingExample/images/3.png",
|
| 793 |
-
"
|
| 794 |
], inputs=[imagebox, textbox], label='Image Understanding Examples')
|
| 795 |
|
| 796 |
gr.Examples(examples=[
|
|
@@ -799,7 +800,7 @@ def build_demo(embed_mode):
|
|
| 799 |
[None, "tiger cub playing with soccer ball"],
|
| 800 |
[None, "screenshot from a 16 bit platform game in a lush green landscape"],
|
| 801 |
[None, "Old car in kandy sri lanka,lake road,flower, bright, sunny, orange sky, photorealistic"],
|
| 802 |
-
[None, "Create a vibrant painting of a tropical beach at sunset
|
| 803 |
], inputs=[imagebox, textbox], label='Image Generation Examples')
|
| 804 |
|
| 805 |
gr.Examples(examples=[
|
|
@@ -818,7 +819,6 @@ def build_demo(embed_mode):
|
|
| 818 |
], inputs=[imagebox, textbox], label='Image Editing Examples')
|
| 819 |
|
| 820 |
if not embed_mode:
|
| 821 |
-
gr.Markdown(tos_markdown)
|
| 822 |
gr.Markdown(learn_more_markdown)
|
| 823 |
|
| 824 |
# Register listeners
|
|
@@ -883,7 +883,7 @@ def build_demo(embed_mode):
|
|
| 883 |
use_diffusion_checkbox.change(
|
| 884 |
fn=update_resolution_dropdown,
|
| 885 |
inputs=[use_diffusion_checkbox, resolution_wh_dropdown],
|
| 886 |
-
outputs=
|
| 887 |
queue=False
|
| 888 |
)
|
| 889 |
|
|
|
|
| 543 |
new_h, new_w = DEFAULT_DIFFUSION_RESOLUTIONS[0]
|
| 544 |
new_value_str = f"{new_h}x{new_w}"
|
| 545 |
return dict(choices=[f'{h}x{w}' for h, w in DEFAULT_DIFFUSION_RESOLUTIONS],
|
| 546 |
+
value=new_value_str)
|
| 547 |
else:
|
| 548 |
new_h, new_w = int(current_h) // 2, int(current_w) // 2
|
| 549 |
|
|
|
|
| 552 |
new_value_str = f"{new_h}x{new_w}"
|
| 553 |
|
| 554 |
return dict(choices=[f'{h}x{w}' for h, w in DEFAULT_RESOLUTIONS],
|
| 555 |
+
value=new_value_str)
|
| 556 |
|
| 557 |
|
| 558 |
# --- Gradio Layout ---
|
|
|
|
| 738 |
label="Output Resolution (HxW)",
|
| 739 |
elem_id="resolution_dropdown",
|
| 740 |
info="Select target size for generated images."
|
| 741 |
+
allow_custom_value=True,
|
| 742 |
)
|
| 743 |
|
| 744 |
llm_cfg_scale = gr.Slider(
|
|
|
|
| 787 |
with gr.Row():
|
| 788 |
gr.Examples(examples=[
|
| 789 |
["examples/ImageUnderstandingExample/images/1.png",
|
|
|
|
|
|
|
| 790 |
"What are they doing?"],
|
| 791 |
+
["examples/ImageUnderstandingExample/images/2.png",
|
| 792 |
+
"Depict the image in detail."],
|
| 793 |
["examples/ImageUnderstandingExample/images/3.png",
|
| 794 |
+
"parse the table"],
|
| 795 |
], inputs=[imagebox, textbox], label='Image Understanding Examples')
|
| 796 |
|
| 797 |
gr.Examples(examples=[
|
|
|
|
| 800 |
[None, "tiger cub playing with soccer ball"],
|
| 801 |
[None, "screenshot from a 16 bit platform game in a lush green landscape"],
|
| 802 |
[None, "Old car in kandy sri lanka,lake road,flower, bright, sunny, orange sky, photorealistic"],
|
| 803 |
+
[None, "Create a vibrant painting of a tropical beach at sunset."],
|
| 804 |
], inputs=[imagebox, textbox], label='Image Generation Examples')
|
| 805 |
|
| 806 |
gr.Examples(examples=[
|
|
|
|
| 819 |
], inputs=[imagebox, textbox], label='Image Editing Examples')
|
| 820 |
|
| 821 |
if not embed_mode:
|
|
|
|
| 822 |
gr.Markdown(learn_more_markdown)
|
| 823 |
|
| 824 |
# Register listeners
|
|
|
|
| 883 |
use_diffusion_checkbox.change(
|
| 884 |
fn=update_resolution_dropdown,
|
| 885 |
inputs=[use_diffusion_checkbox, resolution_wh_dropdown],
|
| 886 |
+
outputs=resolution_wh_dropdown,
|
| 887 |
queue=False
|
| 888 |
)
|
| 889 |
|