prithivMLmods commited on
Commit
6f5213e
·
verified ·
1 Parent(s): eb58b0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -30
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.blue_ish = colors.Color(
15
- name="blue_ish",
16
- c50="#F0F5FF",
17
- c100="#E0EBFF",
18
- c200="#C2D7FF",
19
- c300="#A3C2FF",
20
- c400="#85AFFF",
21
- c500="#4A8DFF",
22
- c600="#3374E6",
23
- c700="#1A5CCC",
24
- c800="#0043B3",
25
- c900="#002B80",
26
- c950="#00144D",
27
  )
28
 
29
- class QwenTheme(Soft):
30
  def __init__(
31
  self,
32
  *,
33
  primary_hue: colors.Color | str = colors.gray,
34
- secondary_hue: colors.Color | str = colors.blue_ish,
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
- body_background_fill="linear-gradient(135deg, *primary_100, *primary_50)",
 
 
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
- button_primary_text_color="white",
 
 
 
 
 
 
 
58
  slider_color="*secondary_500",
59
  slider_color_dark="*secondary_600",
60
  block_title_text_weight="600",
61
- block_border_width="2px",
62
  block_shadow="*shadow_drop_lg",
 
 
 
 
63
  )
64
 
65
- qwen_theme = QwenTheme()
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=qwen_theme) as demo:
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,