jeon commited on
Commit
a0b2b5e
·
1 Parent(s): 7dec94f
hugging-face-korea.png ADDED
theme_dropdown.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pathlib
3
+
4
+ from gradio.themes.utils import ThemeAsset
5
+
6
+
7
+ def create_theme_dropdown():
8
+ import gradio as gr
9
+
10
+ asset_path = pathlib.Path(__file__).parent / "themes"
11
+ themes = []
12
+ for theme_asset in os.listdir(str(asset_path)):
13
+ themes.append(
14
+ (ThemeAsset(theme_asset), gr.Theme.load(str(asset_path / theme_asset)))
15
+ )
16
+
17
+ def make_else_if(theme_asset):
18
+ return f"""
19
+ else if (theme == '{str(theme_asset[0].version)}') {{
20
+ var theme_css = `{theme_asset[1]._get_theme_css()}`
21
+ }}"""
22
+
23
+ head, tail = themes[0], themes[1:]
24
+ if_statement = f"""
25
+ if (theme == "{str(head[0].version)}") {{
26
+ var theme_css = `{head[1]._get_theme_css()}`
27
+ }} {" ".join(make_else_if(t) for t in tail)}
28
+ """
29
+
30
+ latest_to_oldest = sorted([t[0] for t in themes], key=lambda asset: asset.version)[
31
+ ::-1
32
+ ]
33
+ latest_to_oldest = [str(t.version) for t in latest_to_oldest]
34
+
35
+ component = gr.Dropdown(
36
+ choices=latest_to_oldest,
37
+ value=latest_to_oldest[0],
38
+ render=False,
39
+ label="Select Version",
40
+ ).style(container=False)
41
+
42
+ return (
43
+ component,
44
+ f"""
45
+ (theme) => {{
46
+ if (!document.querySelector('.theme-css')) {{
47
+ var theme_elem = document.createElement('style');
48
+ theme_elem.classList.add('theme-css');
49
+ document.head.appendChild(theme_elem);
50
+ }} else {{
51
+ var theme_elem = document.querySelector('.theme-css');
52
+ }}
53
+ {if_statement}
54
+ theme_elem.innerHTML = theme_css;
55
+ }}
56
+ """,
57
+ )
themes/[email protected] ADDED
@@ -0,0 +1,358 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "theme": {
3
+ "_font": [
4
+ {
5
+ "__gradio_font__": true,
6
+ "name": "Source Sans Pro",
7
+ "class": "google"
8
+ },
9
+ {
10
+ "__gradio_font__": true,
11
+ "name": "ui-sans-serif",
12
+ "class": "font"
13
+ },
14
+ {
15
+ "__gradio_font__": true,
16
+ "name": "system-ui",
17
+ "class": "font"
18
+ },
19
+ {
20
+ "__gradio_font__": true,
21
+ "name": "sans-serif",
22
+ "class": "font"
23
+ }
24
+ ],
25
+ "_font_mono": [
26
+ {
27
+ "__gradio_font__": true,
28
+ "name": "IBM Plex Mono",
29
+ "class": "google"
30
+ },
31
+ {
32
+ "__gradio_font__": true,
33
+ "name": "ui-monospace",
34
+ "class": "font"
35
+ },
36
+ {
37
+ "__gradio_font__": true,
38
+ "name": "Consolas",
39
+ "class": "font"
40
+ },
41
+ {
42
+ "__gradio_font__": true,
43
+ "name": "monospace",
44
+ "class": "font"
45
+ }
46
+ ],
47
+ "_stylesheets": [
48
+ "https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@500&display=swap",
49
+ "https://fonts.googleapis.com/css2?family=Open+Sans:wght@500&display=swap"
50
+ ],
51
+ "background_fill_primary": "white",
52
+ "background_fill_primary_dark": "*neutral_950",
53
+ "background_fill_secondary": "*neutral_50",
54
+ "background_fill_secondary_dark": "*neutral_900",
55
+ "block_background_fill": "white",
56
+ "block_background_fill_dark": "*neutral_800",
57
+ "block_border_color": "*border_color_primary",
58
+ "block_border_color_dark": "*border_color_primary",
59
+ "block_border_width": "1px",
60
+ "block_border_width_dark": "1px",
61
+ "block_info_text_color": "*body_text_color_subdued",
62
+ "block_info_text_color_dark": "*body_text_color_subdued",
63
+ "block_info_text_size": "*text_sm",
64
+ "block_info_text_weight": "normal",
65
+ "block_label_background_fill": "*krew_grey_1_lighter_95",
66
+ "block_label_background_fill_dark": "*background_fill_secondary",
67
+ "block_label_border_color": "*border_color_primary",
68
+ "block_label_border_color_dark": "*border_color_primary",
69
+ "block_label_border_width": "1px",
70
+ "block_label_border_width_dark": "1px",
71
+ "block_label_margin": "0",
72
+ "block_label_padding": "*spacing_sm *spacing_lg",
73
+ "block_label_radius": "calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0",
74
+ "block_label_right_radius": "0 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)",
75
+ "block_label_text_color": "*neutral_500",
76
+ "block_label_text_color_dark": "*neutral_200",
77
+ "block_label_text_size": "*text_sm",
78
+ "block_label_text_weight": "normal",
79
+ "block_padding": "*spacing_xl calc(*spacing_xl + 2px)",
80
+ "block_radius": "*radius_lg",
81
+ "block_shadow": "none",
82
+ "block_shadow_dark": "none",
83
+ "block_title_background_fill": "none",
84
+ "block_title_background_fill_dark": "none",
85
+ "block_title_border_color": "none",
86
+ "block_title_border_color_dark": "none",
87
+ "block_title_border_width": "0px",
88
+ "block_title_border_width_dark": "0px",
89
+ "block_title_padding": "0",
90
+ "block_title_radius": "none",
91
+ "block_title_text_color": "*neutral_500",
92
+ "block_title_text_color_dark": "*neutral_200",
93
+ "block_title_text_size": "*text_md",
94
+ "block_title_text_weight": "normal",
95
+ "body_background_fill": "*background_fill_primary",
96
+ "body_background_fill_dark": "*background_fill_primary",
97
+ "body_text_color": "*neutral_800",
98
+ "body_text_color_dark": "*neutral_100",
99
+ "body_text_color_subdued": "*neutral_400",
100
+ "body_text_color_subdued_dark": "*neutral_400",
101
+ "body_text_size": "*text_md",
102
+ "body_text_weight": "normal",
103
+ "border_color_accent": "*krew_yellow_1_lighter_30",
104
+ "border_color_accent_dark": "*neutral_600",
105
+ "border_color_primary": "*neutral_200",
106
+ "border_color_primary_dark": "*neutral_700",
107
+ "button_border_width": "*input_border_width",
108
+ "button_border_width_dark": "*input_border_width",
109
+ "button_cancel_background_fill": "*krew_yellow_1_lighter_40",
110
+ "button_cancel_background_fill_dark": "*button_secondary_background_fill",
111
+ "button_cancel_background_fill_hover": "*krew_yellow_1",
112
+ "button_cancel_background_fill_hover_dark": "*button_cancel_background_fill",
113
+ "button_cancel_border_color": "*button_secondary_border_color",
114
+ "button_cancel_border_color_dark": "*button_secondary_border_color",
115
+ "button_cancel_border_color_hover": "*button_cancel_border_color",
116
+ "button_cancel_border_color_hover_dark": "*button_cancel_border_color",
117
+ "button_cancel_text_color": "*button_secondary_text_color",
118
+ "button_cancel_text_color_dark": "*button_secondary_text_color",
119
+ "button_cancel_text_color_hover": "*button_cancel_text_color",
120
+ "button_cancel_text_color_hover_dark": "*button_cancel_text_color",
121
+ "button_large_padding": "*spacing_lg calc(2 * *spacing_lg)",
122
+ "button_large_radius": "*radius_lg",
123
+ "button_large_text_size": "*text_lg",
124
+ "button_large_text_weight": "600",
125
+ "button_primary_background_fill": "*krew_yellow_2_lighter_30",
126
+ "button_primary_background_fill_dark": "*primary_700",
127
+ "button_primary_background_fill_hover": "*krew_yellow_2",
128
+ "button_primary_background_fill_hover_dark": "*button_primary_background_fill",
129
+ "button_primary_border_color": "*primary_200",
130
+ "button_primary_border_color_dark": "*primary_600",
131
+ "button_primary_border_color_hover": "*button_primary_border_color",
132
+ "button_primary_border_color_hover_dark": "*button_primary_border_color",
133
+ "button_primary_text_color": "*krew_yellow_2_darker_60",
134
+ "button_primary_text_color_dark": "white",
135
+ "button_primary_text_color_hover": "*button_primary_text_color",
136
+ "button_primary_text_color_hover_dark": "*button_primary_text_color",
137
+ "button_secondary_background_fill": "*krew_yellow_1_lighter_40",
138
+ "button_secondary_background_fill_dark": "*neutral_600",
139
+ "button_secondary_background_fill_hover": "*krew_yellow_1",
140
+ "button_secondary_background_fill_hover_dark": "*button_secondary_background_fill",
141
+ "button_secondary_border_color": "*neutral_200",
142
+ "button_secondary_border_color_dark": "*neutral_600",
143
+ "button_secondary_border_color_hover": "*button_secondary_border_color",
144
+ "button_secondary_border_color_hover_dark": "*button_secondary_border_color",
145
+ "button_secondary_text_color": "*krew_yellow_1_darker_60",
146
+ "button_secondary_text_color_dark": "white",
147
+ "button_secondary_text_color_hover": "*button_secondary_text_color",
148
+ "button_secondary_text_color_hover_dark": "*button_secondary_text_color",
149
+ "button_shadow": "none",
150
+ "button_shadow_active": "none",
151
+ "button_shadow_hover": "none",
152
+ "button_small_padding": "*spacing_sm calc(2 * *spacing_sm)",
153
+ "button_small_radius": "*radius_lg",
154
+ "button_small_text_size": "*text_md",
155
+ "button_small_text_weight": "normal",
156
+ "button_transition": "background-color 0.2s ease",
157
+ "checkbox_background_color": "white",
158
+ "checkbox_background_color_dark": "*neutral_800",
159
+ "checkbox_background_color_focus": "white",
160
+ "checkbox_background_color_focus_dark": "*checkbox_background_color",
161
+ "checkbox_background_color_hover": "*checkbox_background_color",
162
+ "checkbox_background_color_hover_dark": "*checkbox_background_color",
163
+ "checkbox_background_color_selected": "*krew_yellow_2",
164
+ "checkbox_background_color_selected_dark": "*secondary_600",
165
+ "checkbox_border_color": "*neutral_300",
166
+ "checkbox_border_color_dark": "*neutral_700",
167
+ "checkbox_border_color_focus": "*neutral_300",
168
+ "checkbox_border_color_focus_dark": "*secondary_500",
169
+ "checkbox_border_color_hover": "*neutral_300",
170
+ "checkbox_border_color_hover_dark": "*neutral_600",
171
+ "checkbox_border_color_selected": "*krew_yellow_2",
172
+ "checkbox_border_color_selected_dark": "*secondary_600",
173
+ "checkbox_border_radius": "*radius_sm",
174
+ "checkbox_border_width": "*input_border_width",
175
+ "checkbox_border_width_dark": "*input_border_width",
176
+ "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\")",
177
+ "checkbox_label_background_fill": "*krew_yellow_1_lighter_40",
178
+ "checkbox_label_background_fill_dark": "*button_secondary_background_fill",
179
+ "checkbox_label_background_fill_hover": "*krew_yellow_1",
180
+ "checkbox_label_background_fill_hover_dark": "*button_secondary_background_fill_hover",
181
+ "checkbox_label_background_fill_selected": "*krew_yellow_1",
182
+ "checkbox_label_background_fill_selected_dark": "*checkbox_label_background_fill",
183
+ "checkbox_label_border_color": "*border_color_primary",
184
+ "checkbox_label_border_color_dark": "*border_color_primary",
185
+ "checkbox_label_border_color_hover": "*checkbox_label_border_color",
186
+ "checkbox_label_border_color_hover_dark": "*checkbox_label_border_color",
187
+ "checkbox_label_border_width": "*input_border_width",
188
+ "checkbox_label_border_width_dark": "*input_border_width",
189
+ "checkbox_label_gap": "*spacing_lg",
190
+ "checkbox_label_padding": "*spacing_md calc(2 * *spacing_md)",
191
+ "checkbox_label_shadow": "none",
192
+ "checkbox_label_text_color": "*krew_yellow_1_darker_60",
193
+ "checkbox_label_text_color_dark": "*body_text_color",
194
+ "checkbox_label_text_color_selected": "*krew_yellow_2_darker_60",
195
+ "checkbox_label_text_color_selected_dark": "*checkbox_label_text_color",
196
+ "checkbox_label_text_size": "*text_md",
197
+ "checkbox_label_text_weight": "normal",
198
+ "checkbox_shadow": "*input_shadow",
199
+ "color_accent": "*krew_yellow_2",
200
+ "color_accent_soft": "*krew_yellow_1_lighter_60",
201
+ "color_accent_soft_dark": "*neutral_700",
202
+ "container_radius": "*radius_lg",
203
+ "embed_radius": "*radius_lg",
204
+ "error_background_fill": "#fee2e2",
205
+ "error_background_fill_dark": "*background_fill_primary",
206
+ "error_border_color": "#fecaca",
207
+ "error_border_color_dark": "*border_color_primary",
208
+ "error_border_width": "1px",
209
+ "error_border_width_dark": "1px",
210
+ "error_text_color": "#ef4444",
211
+ "error_text_color_dark": "#ef4444",
212
+ "font": "'Source Sans Pro', 'ui-sans-serif', 'system-ui', sans-serif",
213
+ "font_mono": "'IBM Plex Mono', 'ui-monospace', 'Consolas', monospace",
214
+ "form_gap_width": "0px",
215
+ "input_background_fill": "*neutral_100",
216
+ "input_background_fill_dark": "*neutral_700",
217
+ "input_background_fill_focus": "*secondary_500",
218
+ "input_background_fill_focus_dark": "*secondary_600",
219
+ "input_background_fill_hover": "*input_background_fill",
220
+ "input_background_fill_hover_dark": "*input_background_fill",
221
+ "input_border_color": "*border_color_primary",
222
+ "input_border_color_dark": "*border_color_primary",
223
+ "input_border_color_focus": "*secondary_300",
224
+ "input_border_color_focus_dark": "*neutral_700",
225
+ "input_border_color_hover": "*input_border_color",
226
+ "input_border_color_hover_dark": "*input_border_color",
227
+ "input_border_width": "0px",
228
+ "input_border_width_dark": "0px",
229
+ "input_padding": "*spacing_xl",
230
+ "input_placeholder_color": "*neutral_400",
231
+ "input_placeholder_color_dark": "*neutral_500",
232
+ "input_radius": "*radius_lg",
233
+ "input_shadow": "none",
234
+ "input_shadow_dark": "none",
235
+ "input_shadow_focus": "*input_shadow",
236
+ "input_shadow_focus_dark": "*input_shadow",
237
+ "input_text_size": "*text_md",
238
+ "input_text_weight": "normal",
239
+ "layout_gap": "*spacing_xxl",
240
+ "link_text_color": "*secondary_600",
241
+ "link_text_color_active": "*secondary_600",
242
+ "link_text_color_active_dark": "*secondary_500",
243
+ "link_text_color_dark": "*secondary_500",
244
+ "link_text_color_hover": "*secondary_700",
245
+ "link_text_color_hover_dark": "*secondary_400",
246
+ "link_text_color_visited": "*secondary_500",
247
+ "link_text_color_visited_dark": "*secondary_600",
248
+ "loader_color": "*krew_yellow_1_lighter_50",
249
+ "loader_color_dark": "*color_accent",
250
+ "name": "base",
251
+ "neutral_100": "#f5f5f4",
252
+ "neutral_200": "#e7e5e4",
253
+ "neutral_300": "#d6d3d1",
254
+ "neutral_400": "#a8a29e",
255
+ "neutral_50": "#fafaf9",
256
+ "neutral_500": "#78716c",
257
+ "neutral_600": "#57534e",
258
+ "neutral_700": "#44403c",
259
+ "neutral_800": "#292524",
260
+ "neutral_900": "#1c1917",
261
+ "neutral_950": "#0f0e0d",
262
+ "panel_background_fill": "*krew_grey_1_lighter_95",
263
+ "panel_background_fill_dark": "*background_fill_secondary",
264
+ "panel_border_color": "*border_color_primary",
265
+ "panel_border_color_dark": "*border_color_primary",
266
+ "panel_border_width": "0",
267
+ "panel_border_width_dark": "0",
268
+ "krew_yellow_1": "#ffd21e",
269
+ "krew_yellow_1_lighter_30": "#ffdf61",
270
+ "krew_yellow_1_lighter_40": "#ffe478",
271
+ "krew_yellow_1_lighter_50": "#ffe88e",
272
+ "krew_yellow_1_lighter_60": "#ffeda5",
273
+ "krew_yellow_1_darker_50": "#8e7200",
274
+ "krew_yellow_1_darker_60": "#725b00",
275
+ "krew_yellow_2": "#ff9d00",
276
+ "krew_yellow_2_lighter_30": "#ffba4d",
277
+ "krew_yellow_2_darker_10": "#e68d00",
278
+ "krew_yellow_2_darker_40": "#995e00",
279
+ "krew_yellow_2_darker_50": "#804f00",
280
+ "krew_yellow_2_darker_60": "#663f00",
281
+ "krew_grey_1": "#595757",
282
+ "krew_grey_1_lighter_30": "#8b8989",
283
+ "krew_grey_1_lighter_50": "#acabab",
284
+ "krew_grey_1_lighter_70": "#cdcccc",
285
+ "krew_grey_1_lighter_80": "#dedddd",
286
+ "krew_grey_1_lighter_90": "#eeeeee",
287
+ "krew_grey_1_lighter_95": "#f7f7f7",
288
+ "krew_grey_2": "#4c4948",
289
+ "primary_100": "#fce7f3",
290
+ "primary_200": "#fbcfe8",
291
+ "primary_300": "#f9a8d4",
292
+ "primary_400": "#f472b6",
293
+ "primary_50": "#fdf2f8",
294
+ "primary_500": "#ec4899",
295
+ "primary_600": "#db2777",
296
+ "primary_700": "#be185d",
297
+ "primary_800": "#9d174d",
298
+ "primary_900": "#831843",
299
+ "primary_950": "#6e1a3d",
300
+ "prose_header_text_weight": "600",
301
+ "prose_text_size": "*text_md",
302
+ "prose_text_weight": "normal",
303
+ "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\")",
304
+ "radius_lg": "0px",
305
+ "radius_md": "0px",
306
+ "radius_sm": "0px",
307
+ "radius_xl": "0px",
308
+ "radius_xs": "0px",
309
+ "radius_xxl": "0px",
310
+ "radius_xxs": "0px",
311
+ "secondary_100": "#fce7f3",
312
+ "secondary_200": "#fbcfe8",
313
+ "secondary_300": "#f9a8d4",
314
+ "secondary_400": "#f472b6",
315
+ "secondary_50": "#fdf2f8",
316
+ "secondary_500": "#ec4899",
317
+ "secondary_600": "#db2777",
318
+ "secondary_700": "#be185d",
319
+ "secondary_800": "#9d174d",
320
+ "secondary_900": "#831843",
321
+ "secondary_950": "#6e1a3d",
322
+ "section_header_text_size": "*text_md",
323
+ "section_header_text_weight": "normal",
324
+ "shadow_drop": "rgba(0,0,0,0.05) 0px 1px 2px 0px",
325
+ "shadow_drop_lg": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
326
+ "shadow_inset": "rgba(0,0,0,0.05) 0px 2px 4px 0px inset",
327
+ "shadow_spread": "3px",
328
+ "shadow_spread_dark": "1px",
329
+ "slider_color": "krew_yellow_1_lighter_40",
330
+ "slider_color_dark": "auto",
331
+ "spacing_lg": "8px",
332
+ "spacing_md": "6px",
333
+ "spacing_sm": "4px",
334
+ "spacing_xl": "10px",
335
+ "spacing_xs": "2px",
336
+ "spacing_xxl": "16px",
337
+ "spacing_xxs": "1px",
338
+ "stat_background_fill": "*primary_300",
339
+ "stat_background_fill_dark": "*primary_500",
340
+ "table_border_color": "*neutral_300",
341
+ "table_border_color_dark": "*neutral_700",
342
+ "table_even_background_fill": "white",
343
+ "table_even_background_fill_dark": "*neutral_950",
344
+ "table_odd_background_fill": "*neutral_50",
345
+ "table_odd_background_fill_dark": "*neutral_900",
346
+ "table_radius": "*radius_lg",
347
+ "table_row_focus": "*color_accent_soft",
348
+ "table_row_focus_dark": "*color_accent_soft",
349
+ "text_lg": "16px",
350
+ "text_md": "14px",
351
+ "text_sm": "12px",
352
+ "text_xl": "22px",
353
+ "text_xs": "10px",
354
+ "text_xxl": "26px",
355
+ "text_xxs": "9px"
356
+ },
357
+ "version": "1.0.0"
358
+ }