prithivMLmods commited on
Commit
ddc5a04
·
verified ·
1 Parent(s): d6df0f4

update app

Browse files
Files changed (1) hide show
  1. app.py +77 -15
app.py CHANGED
@@ -12,6 +12,77 @@ import concurrent.futures
12
  import threading
13
  from typing import Iterable
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  dtype = torch.bfloat16
16
  device = "cuda" if torch.cuda.is_available() else "cpu"
17
 
@@ -247,31 +318,21 @@ with gr.Blocks() as demo:
247
  with gr.Column():
248
  with gr.Row():
249
  with gr.Column():
250
- gr.HTML(
251
- '<span class="vae-badge" '
252
- 'style="background:#dbeafe;color:#1d4ed8;">'
253
- '🟦 Standard VAE</span>'
254
- )
255
  result_standard = gr.Image(
256
- label="Standard VAE",
257
  show_label=False,
258
  interactive=False,
259
  format="png",
260
- height=280,
261
  )
262
 
263
  with gr.Column():
264
- gr.HTML(
265
- '<span class="vae-badge" '
266
- 'style="background:#d1fae5;color:#065f46;">'
267
- '🟩 Small Decoder VAE</span>'
268
- )
269
  result_small = gr.Image(
270
- label="Small Decoder VAE",
271
  show_label=False,
272
  interactive=False,
273
  format="png",
274
- height=280,
275
  )
276
 
277
  seed_output = gr.Number(label="Seed Used", precision=0)
@@ -361,7 +422,8 @@ with gr.Blocks() as demo:
361
 
362
  if __name__ == "__main__":
363
  demo.queue(max_size=20).launch(
364
- theme=gr.themes.Citrus(),
 
365
  css=css,
366
  ssr_mode=False,
367
  show_error=True,
 
12
  import threading
13
  from typing import Iterable
14
 
15
+ from gradio.themes import Soft
16
+ from gradio.themes.utils import colors, fonts, sizes
17
+
18
+ colors.orange_red = colors.Color(
19
+ name="orange_red",
20
+ c50="#FFF0E5",
21
+ c100="#FFE0CC",
22
+ c200="#FFC299",
23
+ c300="#FFA366",
24
+ c400="#FF8533",
25
+ c500="#FF4500",
26
+ c600="#E63E00",
27
+ c700="#CC3700",
28
+ c800="#B33000",
29
+ c900="#992900",
30
+ c950="#802200",
31
+ )
32
+
33
+ class OrangeRedTheme(Soft):
34
+ def __init__(
35
+ self,
36
+ *,
37
+ primary_hue: colors.Color | str = colors.gray,
38
+ secondary_hue: colors.Color | str = colors.orange_red,
39
+ neutral_hue: colors.Color | str = colors.slate,
40
+ text_size: sizes.Size | str = sizes.text_lg,
41
+ font: fonts.Font | str | Iterable[fonts.Font | str] = (
42
+ fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
43
+ ),
44
+ font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
45
+ fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
46
+ ),
47
+ ):
48
+ super().__init__(
49
+ primary_hue=primary_hue,
50
+ secondary_hue=secondary_hue,
51
+ neutral_hue=neutral_hue,
52
+ text_size=text_size,
53
+ font=font,
54
+ font_mono=font_mono,
55
+ )
56
+ super().set(
57
+ background_fill_primary="*primary_50",
58
+ background_fill_primary_dark="*primary_900",
59
+ body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
60
+ body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
61
+ button_primary_text_color="white",
62
+ button_primary_text_color_hover="white",
63
+ button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
64
+ button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
65
+ button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
66
+ button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
67
+ button_secondary_text_color="black",
68
+ button_secondary_text_color_hover="white",
69
+ button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
70
+ button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
71
+ button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
72
+ button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
73
+ slider_color="*secondary_500",
74
+ slider_color_dark="*secondary_600",
75
+ block_title_text_weight="600",
76
+ block_border_width="3px",
77
+ block_shadow="*shadow_drop_lg",
78
+ button_primary_shadow="*shadow_drop_lg",
79
+ button_large_padding="11px",
80
+ color_accent_soft="*primary_100",
81
+ block_label_background_fill="*primary_200",
82
+ )
83
+
84
+ orange_red_theme = OrangeRedTheme()
85
+
86
  dtype = torch.bfloat16
87
  device = "cuda" if torch.cuda.is_available() else "cpu"
88
 
 
318
  with gr.Column():
319
  with gr.Row():
320
  with gr.Column():
 
 
 
 
 
321
  result_standard = gr.Image(
322
+ label="Standard Decoder",
323
  show_label=False,
324
  interactive=False,
325
  format="png",
326
+ height=250,
327
  )
328
 
329
  with gr.Column():
 
 
 
 
 
330
  result_small = gr.Image(
331
+ label="Small Decoder",
332
  show_label=False,
333
  interactive=False,
334
  format="png",
335
+ height=250,
336
  )
337
 
338
  seed_output = gr.Number(label="Seed Used", precision=0)
 
422
 
423
  if __name__ == "__main__":
424
  demo.queue(max_size=20).launch(
425
+ theme=orange_red_theme,
426
+ mcp_server=True,
427
  css=css,
428
  ssr_mode=False,
429
  show_error=True,