Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -15,8 +15,79 @@ from urllib.parse import urlparse
|
|
| 15 |
import tempfile
|
| 16 |
import shutil
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Description for the app
|
| 19 |
-
DESCRIPTION = """## Qwen Image
|
| 20 |
|
| 21 |
# Helper functions
|
| 22 |
def save_image(img):
|
|
@@ -214,16 +285,16 @@ footer {
|
|
| 214 |
# Gradio interface
|
| 215 |
with gr.Blocks(delete_cache=(240, 240)) as demo:
|
| 216 |
gr.Markdown(DESCRIPTION)
|
|
|
|
| 217 |
with gr.Row():
|
| 218 |
prompt = gr.Text(
|
| 219 |
label="Prompt",
|
| 220 |
show_label=False,
|
| 221 |
max_lines=1,
|
| 222 |
-
placeholder="
|
| 223 |
container=False,
|
| 224 |
)
|
| 225 |
run_button = gr.Button("Run", scale=0, variant="primary")
|
| 226 |
-
result = gr.Gallery(label="Result", columns=1, show_label=False, preview=True)
|
| 227 |
|
| 228 |
with gr.Row():
|
| 229 |
aspect_ratio = gr.Dropdown(
|
|
@@ -355,4 +426,4 @@ with gr.Blocks(delete_cache=(240, 240)) as demo:
|
|
| 355 |
)
|
| 356 |
|
| 357 |
if __name__ == "__main__":
|
| 358 |
-
demo.queue(max_size=50).launch(css=css, mcp_server=True, ssr_mode=False, show_error=True)
|
|
|
|
| 15 |
import tempfile
|
| 16 |
import shutil
|
| 17 |
|
| 18 |
+
from gradio.themes import Soft
|
| 19 |
+
from gradio.themes.utils import colors, fonts, sizes
|
| 20 |
+
|
| 21 |
+
colors.orange_red = colors.Color(
|
| 22 |
+
name="orange_red",
|
| 23 |
+
c50="#FFF0E5",
|
| 24 |
+
c100="#FFE0CC",
|
| 25 |
+
c200="#FFC299",
|
| 26 |
+
c300="#FFA366",
|
| 27 |
+
c400="#FF8533",
|
| 28 |
+
c500="#FF4500",
|
| 29 |
+
c600="#E63E00",
|
| 30 |
+
c700="#CC3700",
|
| 31 |
+
c800="#B33000",
|
| 32 |
+
c900="#992900",
|
| 33 |
+
c950="#802200",
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
class OrangeRedTheme(Soft):
|
| 37 |
+
def __init__(
|
| 38 |
+
self,
|
| 39 |
+
*,
|
| 40 |
+
primary_hue: colors.Color | str = colors.gray,
|
| 41 |
+
secondary_hue: colors.Color | str = colors.orange_red, # Use the new color
|
| 42 |
+
neutral_hue: colors.Color | str = colors.slate,
|
| 43 |
+
text_size: sizes.Size | str = sizes.text_lg,
|
| 44 |
+
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
| 45 |
+
fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
|
| 46 |
+
),
|
| 47 |
+
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
| 48 |
+
fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
|
| 49 |
+
),
|
| 50 |
+
):
|
| 51 |
+
super().__init__(
|
| 52 |
+
primary_hue=primary_hue,
|
| 53 |
+
secondary_hue=secondary_hue,
|
| 54 |
+
neutral_hue=neutral_hue,
|
| 55 |
+
text_size=text_size,
|
| 56 |
+
font=font,
|
| 57 |
+
font_mono=font_mono,
|
| 58 |
+
)
|
| 59 |
+
super().set(
|
| 60 |
+
background_fill_primary="*primary_50",
|
| 61 |
+
background_fill_primary_dark="*primary_900",
|
| 62 |
+
body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
|
| 63 |
+
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 64 |
+
button_primary_text_color="white",
|
| 65 |
+
button_primary_text_color_hover="white",
|
| 66 |
+
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 67 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 68 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 69 |
+
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 70 |
+
button_secondary_text_color="black",
|
| 71 |
+
button_secondary_text_color_hover="white",
|
| 72 |
+
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
| 73 |
+
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 74 |
+
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 75 |
+
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 76 |
+
slider_color="*secondary_500",
|
| 77 |
+
slider_color_dark="*secondary_600",
|
| 78 |
+
block_title_text_weight="600",
|
| 79 |
+
block_border_width="3px",
|
| 80 |
+
block_shadow="*shadow_drop_lg",
|
| 81 |
+
button_primary_shadow="*shadow_drop_lg",
|
| 82 |
+
button_large_padding="11px",
|
| 83 |
+
color_accent_soft="*primary_100",
|
| 84 |
+
block_label_background_fill="*primary_200",
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
orange_red_theme = OrangeRedTheme()
|
| 88 |
+
|
| 89 |
# Description for the app
|
| 90 |
+
DESCRIPTION = """## Qwen Image Diffusion"""
|
| 91 |
|
| 92 |
# Helper functions
|
| 93 |
def save_image(img):
|
|
|
|
| 285 |
# Gradio interface
|
| 286 |
with gr.Blocks(delete_cache=(240, 240)) as demo:
|
| 287 |
gr.Markdown(DESCRIPTION)
|
| 288 |
+
result = gr.Gallery(label="Result", columns=1, show_label=False, preview=True)
|
| 289 |
with gr.Row():
|
| 290 |
prompt = gr.Text(
|
| 291 |
label="Prompt",
|
| 292 |
show_label=False,
|
| 293 |
max_lines=1,
|
| 294 |
+
placeholder="Enter your prompt..",
|
| 295 |
container=False,
|
| 296 |
)
|
| 297 |
run_button = gr.Button("Run", scale=0, variant="primary")
|
|
|
|
| 298 |
|
| 299 |
with gr.Row():
|
| 300 |
aspect_ratio = gr.Dropdown(
|
|
|
|
| 426 |
)
|
| 427 |
|
| 428 |
if __name__ == "__main__":
|
| 429 |
+
demo.queue(max_size=50).launch(css=css, theme=orange_red_theme, mcp_server=True, ssr_mode=False, show_error=True)
|