NeoPy commited on
Commit
7e8fe92
·
verified ·
1 Parent(s): da45a79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +121 -111
app.py CHANGED
@@ -3,27 +3,25 @@ from typing import Iterable
3
  import gradio as gr
4
  from gradio.themes.base import Base
5
  from gradio.themes.utils import colors, fonts, sizes
6
- import uuid
7
 
8
- class Neopy(Base):
9
  def __init__(
10
  self,
11
  *,
12
- primary_hue: colors.Color | str = colors.neutral,
13
- secondary_hue: colors.Color | str = colors.neutral,
14
- neutral_hue: colors.Color | str = colors.neutral,
15
  spacing_size: sizes.Size | str = sizes.spacing_md,
16
  radius_size: sizes.Size | str = sizes.radius_md,
17
  text_size: sizes.Size | str = sizes.text_lg,
18
  font: fonts.Font | str | Iterable[fonts.Font | str] = (
19
- "Syne V",
20
- fonts.GoogleFont("Syne"),
21
  "ui-sans-serif",
22
  "system-ui",
23
  ),
24
  font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
25
  "ui-monospace",
26
- fonts.GoogleFont("Nunito Sans"),
27
  ),
28
  ):
29
  super().__init__(
@@ -36,170 +34,182 @@ class Neopy(Base):
36
  font=font,
37
  font_mono=font_mono,
38
  )
39
- self.name = "Neopy"
40
- # Secondary palette (red, used for errors/warnings)
41
- self.secondary_100 = "#b80000"
42
- self.secondary_200 = "#ff6b6b"
43
- self.secondary_300 = "#ff5252"
44
- self.secondary_400 = "#ff3232"
45
- self.secondary_50 = "#bd5151"
46
- self.secondary_500 = "#d31c1c"
47
- self.secondary_600 = "#eb2525"
48
- self.secondary_700 = "#d81d1d"
49
- self.secondary_800 = "#990000" # Fixed from blue to red
50
- self.secondary_900 = "#af1e1e"
51
- self.secondary_950 = "#601d1d"
52
- # Primary palette (blue, for main accents)
53
- self.primary_50 = "#eff6ff"
54
- self.primary_100 = "#dbeafe"
55
- self.primary_200 = "#bfdbfe"
56
- self.primary_300 = "#93c5fd"
57
- self.primary_400 = "#60a5fa"
58
- self.primary_500 = "#3b82f6"
59
- self.primary_600 = "#2563eb"
60
- self.primary_700 = "#1d4ed8"
61
- self.primary_800 = "#1e40af"
62
- self.primary_900 = "#1e3a8a"
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  super().set(
65
  # Backgrounds
66
- background_fill_primary="#110F0F",
67
- background_fill_primary_dark="#110F0F",
68
- background_fill_secondary="#110F0F",
69
- background_fill_secondary_dark="#110F0F",
70
- block_background_fill="*neutral_800",
71
- block_background_fill_dark="*neutral_800",
72
- block_border_color="*border_color_primary",
73
- block_border_width="1px",
74
- block_info_text_color="*body_text_color_subdued",
75
  block_info_text_size="*text_sm",
76
  block_info_text_weight="400",
77
- block_label_background_fill="*background_fill_primary",
78
- block_label_background_fill_dark="*background_fill_secondary",
79
- block_label_border_color="*border_color_primary",
80
  block_label_border_width="1px",
81
  block_label_margin="0",
82
  block_label_padding="*spacing_sm *spacing_lg",
83
- block_label_radius="calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0",
84
- block_label_right_radius="0 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)",
85
- block_label_shadow="*block_shadow",
86
- block_label_text_color="*body_text_color",
87
- block_label_text_color_dark="*body_text_color",
88
  block_label_text_weight="400",
89
  block_padding="*spacing_xl",
90
  block_radius="*radius_md",
91
- block_shadow="*shadow_drop", # Added subtle shadow
92
- block_title_background_fill="rgb(255,255,255)",
93
  block_title_border_color="none",
94
  block_title_border_width="0px",
95
- block_title_padding="*block_label_padding",
96
- block_title_radius="*block_label_radius",
97
- block_title_text_color="#110F0F",
98
- block_title_text_size="*text_lg", # Increased for hierarchy
99
- block_title_text_weight="600",
100
- body_background_fill="#110F0F",
101
  body_text_color="white",
102
- body_text_color_subdued="#cecece",
103
  body_text_size="*text_md",
104
  body_text_weight="400",
105
- border_color_accent="#cecece",
106
- border_color_primary="#cecece",
107
  # Buttons
108
- button_border_width="*input_border_width",
109
- button_cancel_background_fill="*button_secondary_background_fill",
110
- button_cancel_border_color="*button_secondary_border_color",
111
- button_cancel_text_color="#110F0F",
112
  button_large_padding="*spacing_lg calc(2 * *spacing_lg)",
113
- button_large_radius="*radius_lg",
114
  button_large_text_size="*text_lg",
115
  button_large_text_weight="600",
 
116
  button_primary_background_fill="*primary_500",
117
- button_primary_background_fill_hover="*primary_400", # Added hover effect
118
- button_primary_border_color="*primary_500", # Fixed to match background
119
  button_primary_border_color_hover="*primary_400",
120
  button_primary_text_color="white",
121
- button_primary_text_color_hover="white",
122
- button_secondary_background_fill="#6a6a6a",
123
- button_secondary_background_fill_hover="*neutral_600", # Added hover effect
124
  button_secondary_border_color="*neutral_700",
125
  button_secondary_text_color="white",
126
  button_small_padding="*spacing_sm calc(2 * *spacing_sm)",
127
- button_small_radius="*radius_lg",
128
  button_small_text_size="*text_md",
129
  button_small_text_weight="400",
130
  button_transition="0.3s ease all",
131
  # Checkboxes
132
- checkbox_background_color="*neutral_700",
133
- checkbox_background_color_selected="*primary_500", # Fixed to blue
134
  checkbox_border_color="*neutral_700",
135
  checkbox_border_color_focus="*primary_500",
136
  checkbox_border_color_selected="*primary_500",
137
  checkbox_border_radius="*radius_sm",
138
- checkbox_border_width="*input_border_width",
139
  checkbox_check="url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")",
140
  checkbox_label_background_fill="transparent",
141
  checkbox_label_border_color="transparent",
142
- checkbox_label_border_width="transparent",
143
  checkbox_label_gap="*spacing_lg",
144
  checkbox_label_padding="*spacing_md calc(2 * *spacing_md)",
145
  checkbox_label_shadow="none",
146
- checkbox_label_text_color="*body_text_color",
147
  checkbox_label_text_size="*text_md",
148
  checkbox_label_text_weight="400",
149
- checkbox_shadow="*input_shadow",
150
  color_accent="*primary_500",
151
- color_accent_soft="*primary_50",
152
- container_radius="*radius_xl",
153
- embed_radius="*radius_lg",
154
  # Errors
155
- error_background_fill="*background_fill_primary",
156
- error_border_color="*border_color_primary",
157
- error_border_width="1px",
158
- error_text_color="*secondary_700",
159
- error_text_color_dark="*secondary_600",
160
  form_gap_width="0px",
161
  # Inputs
162
  input_background_fill="*neutral_900",
163
- input_background_fill_focus="*primary_50",
164
  input_border_color="*neutral_700",
165
  input_border_color_focus="*primary_500",
166
- input_border_width="1px",
167
  input_padding="*spacing_xl",
168
  input_placeholder_color="*neutral_500",
169
- input_radius="*radius_lg",
170
- input_shadow="*shadow_drop", # Added subtle shadow
171
  input_text_size="*text_md",
172
  input_text_weight="400",
173
  layout_gap="*spacing_xxl",
174
  # Links
175
- link_text_color="*primary_500",
176
- link_text_color_active="*primary_500",
177
- link_text_color_hover="*primary_400",
178
- link_text_color_visited="*primary_600",
179
- loader_color="*color_accent",
180
- panel_background_fill="*background_fill_secondary",
181
- panel_border_color="*border_color_primary",
182
- panel_border_width="1px",
183
  prose_header_text_weight="600",
184
  prose_text_size="*text_md",
185
  prose_text_weight="400",
186
- radio_circle="url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c дж/svg%3e\")",
187
- section_header_text_size="*text_md",
188
- section_header_text_weight="400",
189
- shadow_drop="rgba(0,0,0,0.05) 0px 1px 2px 0px",
190
- shadow_drop_lg="0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
191
- shadow_inset="rgba(0,0,0,0.05) 0px 2px 4px 0px inset",
192
- shadow_spread="3px",
193
- slider_color="*primary_500", # Changed to blue
194
  stat_background_fill="*primary_500",
195
- table_border_color="*neutral_700", # Improved contrast
196
- table_even_background_fill="*neutral_800", # Lighter for readability
197
- table_odd_background_fill="*neutral_700", # Lighter for readability
198
- table_radius="*radius_lg",
199
- table_row_focus="*color_accent_soft",
200
  )
201
 
202
- theme = Neopy()
203
 
204
 
205
 
 
3
  import gradio as gr
4
  from gradio.themes.base import Base
5
  from gradio.themes.utils import colors, fonts, sizes
 
6
 
7
+ class ShadowTheHedgehog(Base):
8
  def __init__(
9
  self,
10
  *,
11
+ primary_hue: colors.Color | str = colors.red, # Red for Shadow's stripes
12
+ secondary_hue: colors.Color | str = colors.amber, # Gold for Chaos Emeralds
13
+ neutral_hue: colors.Color | str = colors.gray, # Dark grays for edgy vibe
14
  spacing_size: sizes.Size | str = sizes.spacing_md,
15
  radius_size: sizes.Size | str = sizes.radius_md,
16
  text_size: sizes.Size | str = sizes.text_lg,
17
  font: fonts.Font | str | Iterable[fonts.Font | str] = (
18
+ fonts.GoogleFont("Orbitron"), # Futuristic font for Shadow's vibe
 
19
  "ui-sans-serif",
20
  "system-ui",
21
  ),
22
  font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
23
  "ui-monospace",
24
+ fonts.GoogleFont("Roboto Mono"),
25
  ),
26
  ):
27
  super().__init__(
 
34
  font=font,
35
  font_mono=font_mono,
36
  )
37
+ self.name = "ShadowTheHedgehog"
38
+ # Primary palette (red, for main accents)
39
+ self.primary_50 = "#fff5f5"
40
+ self.primary_100 = "#ffe4e4"
41
+ self.primary_200 = "#ffbfbf"
42
+ self.primary_300 = "#ff9999"
43
+ self.primary_400 = "#ff6666"
44
+ self.primary_500 = "#ff0000" # Shadow's iconic red
45
+ self.primary_600 = "#e60000"
46
+ self.primary_700 = "#cc0000"
47
+ self.primary_800 = "#b30000"
48
+ self.primary_900 = "#990000"
49
+ # Secondary palette (gold, for accents)
50
+ self.secondary_50 = "#fffbeb"
51
+ self.secondary_100 = "#fef3c7"
52
+ self.secondary_200 = "#fde68a"
53
+ self.secondary_300 = "#fcd34d"
54
+ self.secondary_400 = "#fbbf24"
55
+ self.secondary_500 = "#FFD700" # Gold for Chaos Emeralds
56
+ self.secondary_600 = "#d4af37"
57
+ self.secondary_700 = "#b8860b"
58
+ self.secondary_800 = "#9c6d00"
59
+ self.secondary_900 = "#7f5500"
60
+ # Neutral palette (dark grays/black for background)
61
+ self.neutral_50 = "#f7f7f7"
62
+ self.neutral_100 = "#e5e5e5"
63
+ self.neutral_200 = "#cccccc"
64
+ self.neutral_300 = "#b3b3b3"
65
+ self.neutral_400 = "#999999"
66
+ self.neutral_500 = "#808080"
67
+ self.neutral_600 = "#666666"
68
+ self.neutral_700 = "#4d4d4d"
69
+ self.neutral_800 = "#333333"
70
+ self.neutral_900 = "#1C2526" # Shadow's dark aesthetic
71
+ self.neutral_950 = "#141414"
72
 
73
  super().set(
74
  # Backgrounds
75
+ background_fill_primary="#1C2526", # Dark black/gray
76
+ background_fill_primary_dark="#1C2526",
77
+ background_fill_secondary="#333333", # Slightly lighter for panels
78
+ background_fill_secondary_dark="#333333",
79
+ block_background_fill="*neutral_900",
80
+ block_background_fill_dark="*neutral_900",
81
+ block_border_color="*neutral_700",
82
+ block_border_width="2px", # Sharper borders
83
+ block_info_text_color="*neutral_400",
84
  block_info_text_size="*text_sm",
85
  block_info_text_weight="400",
86
+ block_label_background_fill="*neutral_900",
87
+ block_label_background_fill_dark="*neutral_900",
88
+ block_label_border_color="*neutral_700",
89
  block_label_border_width="1px",
90
  block_label_margin="0",
91
  block_label_padding="*spacing_sm *spacing_lg",
92
+ block_label_radius="*radius_md",
93
+ block_label_right_radius="*radius_md",
94
+ block_label_shadow="*shadow_drop_lg",
95
+ block_label_text_color="white",
96
+ block_label_text_color_dark="white",
97
  block_label_text_weight="400",
98
  block_padding="*spacing_xl",
99
  block_radius="*radius_md",
100
+ block_shadow="*shadow_drop_lg", # Bold shadow for depth
101
+ block_title_background_fill="*neutral_800",
102
  block_title_border_color="none",
103
  block_title_border_width="0px",
104
+ block_title_padding="*spacing_md *spacing_lg",
105
+ block_title_radius="*radius_md",
106
+ block_title_text_color="*secondary_400", # Gold titles
107
+ block_title_text_size="*text_xl", # Larger for hierarchy
108
+ block_title_text_weight="700", # Bold for Shadow's presence
109
+ body_background_fill="#1C2526",
110
  body_text_color="white",
111
+ body_text_color_subdued="#b3b3b3",
112
  body_text_size="*text_md",
113
  body_text_weight="400",
114
+ border_color_accent="*secondary_500", # Gold accents
115
+ border_color_primary="*neutral_700",
116
  # Buttons
117
+ button_border_width="2px",
118
+ button_cancel_background_fill="*neutral_800",
119
+ button_cancel_border_color="*neutral_700",
120
+ button_cancel_text_color="white",
121
  button_large_padding="*spacing_lg calc(2 * *spacing_lg)",
122
+ button_large_radius="*radius_md",
123
  button_large_text_size="*text_lg",
124
  button_large_text_weight="600",
125
+ button_primary_background_fill, # Red buttons
126
  button_primary_background_fill="*primary_500",
127
+ button_primary_background_fill_hover="*primary_400",
128
+ button_primary_border_color="*primary_500",
129
  button_primary_border_color_hover="*primary_400",
130
  button_primary_text_color="white",
131
+ button_primary_text_color_hover="*secondary_400", # Gold text on hover
132
+ button_secondary_background_fill="*neutral_800",
133
+ button_secondary_background_fill_hover="*neutral_700",
134
  button_secondary_border_color="*neutral_700",
135
  button_secondary_text_color="white",
136
  button_small_padding="*spacing_sm calc(2 * *spacing_sm)",
137
+ button_small_radius="*radius_md",
138
  button_small_text_size="*text_md",
139
  button_small_text_weight="400",
140
  button_transition="0.3s ease all",
141
  # Checkboxes
142
+ checkbox_background_color="*neutral_800",
143
+ checkbox_background_color_selected="*primary_500", # Red when selected
144
  checkbox_border_color="*neutral_700",
145
  checkbox_border_color_focus="*primary_500",
146
  checkbox_border_color_selected="*primary_500",
147
  checkbox_border_radius="*radius_sm",
148
+ checkbox_border_width="2px",
149
  checkbox_check="url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")",
150
  checkbox_label_background_fill="transparent",
151
  checkbox_label_border_color="transparent",
152
+ checkbox_label_border_width="0px",
153
  checkbox_label_gap="*spacing_lg",
154
  checkbox_label_padding="*spacing_md calc(2 * *spacing_md)",
155
  checkbox_label_shadow="none",
156
+ checkbox_label_text_color="white",
157
  checkbox_label_text_size="*text_md",
158
  checkbox_label_text_weight="400",
159
+ checkbox_shadow="*shadow_drop",
160
  color_accent="*primary_500",
161
+ color_accent_soft="*primary_100",
162
+ container_radius="*radius_lg",
163
+ embed_radius="*radius_md",
164
  # Errors
165
+ error_background_fill="*neutral_900",
166
+ error_border_color="*primary_700",
167
+ error_border_width="2px",
168
+ error_text_color="*primary_400",
169
+ error_text_color_dark="*primary_300",
170
  form_gap_width="0px",
171
  # Inputs
172
  input_background_fill="*neutral_900",
173
+ input_background_fill_focus="*primary_100",
174
  input_border_color="*neutral_700",
175
  input_border_color_focus="*primary_500",
176
+ input_border_width="2px",
177
  input_padding="*spacing_xl",
178
  input_placeholder_color="*neutral_500",
179
+ input_radius="*radius_md",
180
+ input_shadow="*shadow_drop_lg",
181
  input_text_size="*text_md",
182
  input_text_weight="400",
183
  layout_gap="*spacing_xxl",
184
  # Links
185
+ link_text_color="*secondary_500", # Gold links
186
+ link_text_color_active="*secondary_400",
187
+ link_text_color_hover="*secondary_300",
188
+ link_text_color_visited="*secondary_600",
189
+ loader_color="*primary_500",
190
+ panel_background_fill="*neutral_900",
191
+ panel_border_color="*neutral_700",
192
+ panel_border_width="2px",
193
  prose_header_text_weight="600",
194
  prose_text_size="*text_md",
195
  prose_text_weight="400",
196
+ radio_circle="url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\")",
197
+ section_header_text_size="*text_lg",
198
+ section_header_text_weight="600",
199
+ shadow_drop="rgba(0,0,0,0.2) 0px 2px 4px 0px",
200
+ shadow_drop_lg="0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2)",
201
+ shadow_inset="rgba(0,0,0,0.2) 0px 2px 4px 0px inset",
202
+ shadow_spread="4px",
203
+ slider_color="*primary_500", # Red slider
204
  stat_background_fill="*primary_500",
205
+ table_border_color="*neutral_600", # Improved contrast
206
+ table_even_background_fill="*neutral_850", # Slightly lighter
207
+ table_odd_background_fill="*neutral_800",
208
+ table_radius="*radius_md",
209
+ table_row_focus="*primary_100",
210
  )
211
 
212
+ theme = ShadowTheHedgehog()
213
 
214
 
215