prithivMLmods commited on
Commit
150cd13
·
verified ·
1 Parent(s): b3f1b85

update app

Browse files
Files changed (1) hide show
  1. app.py +80 -11
app.py CHANGED
@@ -12,6 +12,78 @@ import time
12
  import zipfile
13
  from transformers import CLIPTextModel, CLIPTokenizer, T5EncoderModel, T5TokenizerFast
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  # ---- CUDA Check ----
16
  print("CUDA_VISIBLE_DEVICES=", os.environ.get("CUDA_VISIBLE_DEVICES"))
17
  print("torch.__version__ =", torch.__version__)
@@ -22,9 +94,6 @@ if torch.cuda.is_available():
22
  print("current device:", torch.cuda.current_device())
23
  print("device name:", torch.cuda.get_device_name(torch.cuda.current_device()))
24
 
25
- # Description for the app
26
- DESCRIPTION = """## flux realism hpc/."""
27
-
28
  # Helper functions
29
  def save_image(img):
30
  unique_name = str(uuid.uuid4()) + ".png"
@@ -404,6 +473,7 @@ css = '''
404
  max-width: 590px !important;
405
  margin: 0 auto !important;
406
  }
 
407
  h1 {
408
  text-align: center;
409
  }
@@ -414,18 +484,17 @@ footer {
414
 
415
  # Gradio interface
416
  with gr.Blocks() as demo:
417
- gr.Markdown(DESCRIPTION)
 
418
  with gr.Row():
419
  prompt = gr.Text(
420
  label="Prompt",
421
- show_label=False,
422
- max_lines=1,
423
  placeholder="Enter your prompt",
424
- container=False,
425
  )
426
- run_button = gr.Button("Run", scale=0, variant="primary")
427
- result = gr.Gallery(label="Result", columns=1, show_label=False, preview=True)
428
-
429
  with gr.Row():
430
  # Model choice radio button above additional options
431
  model_choice = gr.Radio(
@@ -540,4 +609,4 @@ with gr.Blocks() as demo:
540
  )
541
 
542
  if __name__ == "__main__":
543
- demo.queue(max_size=30).launch(css=css, theme="bethecloud/storj_theme", mcp_server=True, ssr_mode=False, show_error=True)
 
12
  import zipfile
13
  from transformers import CLIPTextModel, CLIPTokenizer, T5EncoderModel, T5TokenizerFast
14
 
15
+ from typing import Iterable
16
+ from gradio.themes import Soft
17
+ from gradio.themes.utils import colors, fonts, sizes
18
+
19
+ colors.orange_red = colors.Color(
20
+ name="orange_red",
21
+ c50="#FFF0E5",
22
+ c100="#FFE0CC",
23
+ c200="#FFC299",
24
+ c300="#FFA366",
25
+ c400="#FF8533",
26
+ c500="#FF4500",
27
+ c600="#E63E00",
28
+ c700="#CC3700",
29
+ c800="#B33000",
30
+ c900="#992900",
31
+ c950="#802200",
32
+ )
33
+
34
+ class OrangeRedTheme(Soft):
35
+ def __init__(
36
+ self,
37
+ *,
38
+ primary_hue: colors.Color | str = colors.gray,
39
+ secondary_hue: colors.Color | str = colors.orange_red, # Use the new color
40
+ neutral_hue: colors.Color | str = colors.slate,
41
+ text_size: sizes.Size | str = sizes.text_lg,
42
+ font: fonts.Font | str | Iterable[fonts.Font | str] = (
43
+ fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
44
+ ),
45
+ font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
46
+ fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
47
+ ),
48
+ ):
49
+ super().__init__(
50
+ primary_hue=primary_hue,
51
+ secondary_hue=secondary_hue,
52
+ neutral_hue=neutral_hue,
53
+ text_size=text_size,
54
+ font=font,
55
+ font_mono=font_mono,
56
+ )
57
+ super().set(
58
+ background_fill_primary="*primary_50",
59
+ background_fill_primary_dark="*primary_900",
60
+ body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
61
+ body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
62
+ button_primary_text_color="white",
63
+ button_primary_text_color_hover="white",
64
+ button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
65
+ button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
66
+ button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
67
+ button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
68
+ button_secondary_text_color="black",
69
+ button_secondary_text_color_hover="white",
70
+ button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
71
+ button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
72
+ button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
73
+ button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
74
+ slider_color="*secondary_500",
75
+ slider_color_dark="*secondary_600",
76
+ block_title_text_weight="600",
77
+ block_border_width="3px",
78
+ block_shadow="*shadow_drop_lg",
79
+ button_primary_shadow="*shadow_drop_lg",
80
+ button_large_padding="11px",
81
+ color_accent_soft="*primary_100",
82
+ block_label_background_fill="*primary_200",
83
+ )
84
+
85
+ orange_red_theme = OrangeRedTheme()
86
+
87
  # ---- CUDA Check ----
88
  print("CUDA_VISIBLE_DEVICES=", os.environ.get("CUDA_VISIBLE_DEVICES"))
89
  print("torch.__version__ =", torch.__version__)
 
94
  print("current device:", torch.cuda.current_device())
95
  print("device name:", torch.cuda.get_device_name(torch.cuda.current_device()))
96
 
 
 
 
97
  # Helper functions
98
  def save_image(img):
99
  unique_name = str(uuid.uuid4()) + ".png"
 
473
  max-width: 590px !important;
474
  margin: 0 auto !important;
475
  }
476
+ #main-title h1 { font-size: 2.3em !important; }
477
  h1 {
478
  text-align: center;
479
  }
 
484
 
485
  # Gradio interface
486
  with gr.Blocks() as demo:
487
+ gr.Markdown("# **Flux-Realism**", elem_id="main-title")
488
+ result = gr.Gallery(label="Result", columns=1, show_label=False, preview=True)
489
  with gr.Row():
490
  prompt = gr.Text(
491
  label="Prompt",
492
+ show_label=True,
493
+ max_lines=2,
494
  placeholder="Enter your prompt",
 
495
  )
496
+ run_button = gr.Button("Run", scale=0, variant="primary")
497
+
 
498
  with gr.Row():
499
  # Model choice radio button above additional options
500
  model_choice = gr.Radio(
 
609
  )
610
 
611
  if __name__ == "__main__":
612
+ demo.queue(max_size=30).launch(css=css, theme=orange_red_theme, mcp_server=True, ssr_mode=False, show_error=True)