Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,31 +7,30 @@ import random
|
|
| 7 |
from PIL import Image
|
| 8 |
from typing import Iterable
|
| 9 |
|
| 10 |
-
# --- Gradio Theme ---
|
| 11 |
from gradio.themes import Soft
|
| 12 |
from gradio.themes.utils import colors, fonts, sizes
|
| 13 |
|
| 14 |
-
colors.
|
| 15 |
-
name="
|
| 16 |
-
c50="#
|
| 17 |
-
c100="#
|
| 18 |
-
c200="#
|
| 19 |
-
c300="#
|
| 20 |
-
c400="#
|
| 21 |
-
c500="#
|
| 22 |
-
c600="#
|
| 23 |
-
c700="#
|
| 24 |
-
c800="#
|
| 25 |
-
c900="#
|
| 26 |
-
c950="#
|
| 27 |
)
|
| 28 |
|
| 29 |
-
class
|
| 30 |
def __init__(
|
| 31 |
self,
|
| 32 |
*,
|
| 33 |
primary_hue: colors.Color | str = colors.gray,
|
| 34 |
-
secondary_hue: colors.Color | str = colors.
|
| 35 |
neutral_hue: colors.Color | str = colors.slate,
|
| 36 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 37 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
@@ -50,22 +49,35 @@ class QwenTheme(Soft):
|
|
| 50 |
font_mono=font_mono,
|
| 51 |
)
|
| 52 |
super().set(
|
| 53 |
-
|
|
|
|
|
|
|
| 54 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
|
|
|
|
|
|
| 55 |
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 56 |
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
slider_color="*secondary_500",
|
| 59 |
slider_color_dark="*secondary_600",
|
| 60 |
block_title_text_weight="600",
|
| 61 |
-
block_border_width="
|
| 62 |
block_shadow="*shadow_drop_lg",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
)
|
| 64 |
|
| 65 |
-
|
| 66 |
|
| 67 |
-
|
| 68 |
-
# --- Model Loading ---
|
| 69 |
from diffusers import FlowMatchEulerDiscreteScheduler
|
| 70 |
from optimization import optimize_pipeline_
|
| 71 |
from qwenimage.pipeline_qwenimage_edit_plus import QwenImageEditPlusPipeline
|
|
@@ -196,7 +208,7 @@ css="""
|
|
| 196 |
#main-title h1 {font-size: 2.1em !important;}
|
| 197 |
"""
|
| 198 |
|
| 199 |
-
with gr.Blocks(css=css, theme=
|
| 200 |
with gr.Column(elem_id="col-container"):
|
| 201 |
gr.Markdown("# **Qwen-Image-Edit-2509-LoRAs-Fast**", elem_id="main-title")
|
| 202 |
gr.Markdown("Perform diverse image edits using specialized LoRA adapters for the Qwen-Image-Edit model.")
|
|
@@ -204,13 +216,7 @@ with gr.Blocks(css=css, theme=qwen_theme) as demo:
|
|
| 204 |
with gr.Row():
|
| 205 |
with gr.Column():
|
| 206 |
input_image = gr.Image(label="Upload Image", type="pil")
|
| 207 |
-
|
| 208 |
-
lora_adapter = gr.Dropdown(
|
| 209 |
-
label="Choose Editing Style",
|
| 210 |
-
choices=["Photo-to-Anime", "Multiple-Angles", "Light-Restoration", "Relight"],
|
| 211 |
-
value="Photo-to-Anime"
|
| 212 |
-
)
|
| 213 |
-
|
| 214 |
prompt = gr.Text(
|
| 215 |
label="Edit Prompt",
|
| 216 |
show_label=True,
|
|
|
|
| 7 |
from PIL import Image
|
| 8 |
from typing import Iterable
|
| 9 |
|
|
|
|
| 10 |
from gradio.themes import Soft
|
| 11 |
from gradio.themes.utils import colors, fonts, sizes
|
| 12 |
|
| 13 |
+
colors.steel_blue = colors.Color(
|
| 14 |
+
name="steel_blue",
|
| 15 |
+
c50="#EBF3F8",
|
| 16 |
+
c100="#D3E5F0",
|
| 17 |
+
c200="#A8CCE1",
|
| 18 |
+
c300="#7DB3D2",
|
| 19 |
+
c400="#529AC3",
|
| 20 |
+
c500="#4682B4",
|
| 21 |
+
c600="#3E72A0",
|
| 22 |
+
c700="#36638C",
|
| 23 |
+
c800="#2E5378",
|
| 24 |
+
c900="#264364",
|
| 25 |
+
c950="#1E3450",
|
| 26 |
)
|
| 27 |
|
| 28 |
+
class SteelBlueTheme(Soft):
|
| 29 |
def __init__(
|
| 30 |
self,
|
| 31 |
*,
|
| 32 |
primary_hue: colors.Color | str = colors.gray,
|
| 33 |
+
secondary_hue: colors.Color | str = colors.steel_blue,
|
| 34 |
neutral_hue: colors.Color | str = colors.slate,
|
| 35 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 36 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
|
|
| 49 |
font_mono=font_mono,
|
| 50 |
)
|
| 51 |
super().set(
|
| 52 |
+
background_fill_primary="*primary_50",
|
| 53 |
+
background_fill_primary_dark="*primary_900",
|
| 54 |
+
body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
|
| 55 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 56 |
+
button_primary_text_color="white",
|
| 57 |
+
button_primary_text_color_hover="white",
|
| 58 |
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 59 |
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 60 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_800)",
|
| 61 |
+
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_500)",
|
| 62 |
+
button_secondary_text_color="black",
|
| 63 |
+
button_secondary_text_color_hover="white",
|
| 64 |
+
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
| 65 |
+
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 66 |
+
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 67 |
+
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 68 |
slider_color="*secondary_500",
|
| 69 |
slider_color_dark="*secondary_600",
|
| 70 |
block_title_text_weight="600",
|
| 71 |
+
block_border_width="3px",
|
| 72 |
block_shadow="*shadow_drop_lg",
|
| 73 |
+
button_primary_shadow="*shadow_drop_lg",
|
| 74 |
+
button_large_padding="11px",
|
| 75 |
+
color_accent_soft="*primary_100",
|
| 76 |
+
block_label_background_fill="*primary_200",
|
| 77 |
)
|
| 78 |
|
| 79 |
+
steel_blue_theme = SteelBlueTheme()
|
| 80 |
|
|
|
|
|
|
|
| 81 |
from diffusers import FlowMatchEulerDiscreteScheduler
|
| 82 |
from optimization import optimize_pipeline_
|
| 83 |
from qwenimage.pipeline_qwenimage_edit_plus import QwenImageEditPlusPipeline
|
|
|
|
| 208 |
#main-title h1 {font-size: 2.1em !important;}
|
| 209 |
"""
|
| 210 |
|
| 211 |
+
with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
|
| 212 |
with gr.Column(elem_id="col-container"):
|
| 213 |
gr.Markdown("# **Qwen-Image-Edit-2509-LoRAs-Fast**", elem_id="main-title")
|
| 214 |
gr.Markdown("Perform diverse image edits using specialized LoRA adapters for the Qwen-Image-Edit model.")
|
|
|
|
| 216 |
with gr.Row():
|
| 217 |
with gr.Column():
|
| 218 |
input_image = gr.Image(label="Upload Image", type="pil")
|
| 219 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
prompt = gr.Text(
|
| 221 |
label="Edit Prompt",
|
| 222 |
show_label=True,
|