Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,101 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
|
|
3 |
|
4 |
-
class
|
5 |
-
def __init__(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
super().__init__(
|
7 |
-
primary_hue=
|
8 |
-
secondary_hue=
|
9 |
-
neutral_hue=
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
)
|
16 |
-
self.name = "
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
)
|
31 |
|
32 |
|
@@ -41,7 +110,7 @@ demo = gr.Interface(
|
|
41 |
fn=your_function,
|
42 |
inputs=gr.Textbox(),
|
43 |
outputs=gr.Textbox(),
|
44 |
-
theme=
|
45 |
title="Test App",
|
46 |
)
|
47 |
|
|
|
1 |
+
from future import annotations
|
2 |
+
from typing import Iterable
|
3 |
import gradio as gr
|
4 |
+
gr.themes.builder()
|
5 |
+
from gradio.themes.base import Base
|
6 |
+
from gradio.themes.utils import colors, fonts, sizes
|
7 |
|
8 |
+
class Modern(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 |
+
"ui-sans-serif",
|
20 |
+
"system-ui",
|
21 |
+
"Segoe UI",
|
22 |
+
"Roboto",
|
23 |
+
),
|
24 |
+
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
25 |
+
"ui-monospace",
|
26 |
+
"SFMono-Regular",
|
27 |
+
"Consolas",
|
28 |
+
),
|
29 |
+
):
|
30 |
super().__init__(
|
31 |
+
primary_hue=primary_hue,
|
32 |
+
secondary_hue=secondary_hue,
|
33 |
+
neutral_hue=neutral_hue,
|
34 |
+
spacing_size=spacing_size,
|
35 |
+
radius_size=radius_size,
|
36 |
+
text_size=text_size,
|
37 |
+
font=font,
|
38 |
+
font_mono=font_mono,
|
39 |
)
|
40 |
+
self.name = ("Modern",)
|
41 |
+
|
42 |
+
def set(self):
|
43 |
+
super().set(
|
44 |
+
# Base styles
|
45 |
+
background_fill_primary="#0F0F0F",
|
46 |
+
background_fill_primary_dark="#0F0F0F",
|
47 |
+
background_fill_secondary="#0F0F0F",
|
48 |
+
background_fill_secondary_dark="#0F0F0F",
|
49 |
+
body_text_color="white",
|
50 |
+
body_text_color_dark="white",
|
51 |
+
body_text_color_subdued="#999",
|
52 |
+
body_text_color_subdued_dark="#999",
|
53 |
+
border_color_primary="#333",
|
54 |
+
border_color_primary_dark="#333",
|
55 |
+
spacing_size=sizes.spacing_md,
|
56 |
+
|
57 |
+
# Blocks
|
58 |
+
block_radius="0 0 0 0",
|
59 |
+
block_border_width="1px",
|
60 |
+
block_border_color="#333",
|
61 |
+
block_background_fill="#151515",
|
62 |
+
block_padding="*spacing_lg",
|
63 |
+
block_margin="*spacing_md 0",
|
64 |
+
|
65 |
+
# Buttons
|
66 |
+
button_primary_background_fill="#111",
|
67 |
+
button_primary_background_fill_hover="#222",
|
68 |
+
button_primary_text_color="white",
|
69 |
+
button_secondary_background_fill="transparent",
|
70 |
+
button_secondary_border_color="#666",
|
71 |
+
button_secondary_text_color="#fff",
|
72 |
+
button_secondary_border_width="1px",
|
73 |
+
button_radius="6px",
|
74 |
+
button_transition="0.2s",
|
75 |
+
|
76 |
+
# Inputs
|
77 |
+
input_background_fill="#181818",
|
78 |
+
input_border_color="#444",
|
79 |
+
input_text_color="white",
|
80 |
+
input_padding="*spacing_md",
|
81 |
+
input_radius="6px",
|
82 |
+
input_border_width="1px",
|
83 |
+
|
84 |
+
# Textarea
|
85 |
+
textarea_background_fill="#181818",
|
86 |
+
textarea_border_color="#444",
|
87 |
+
textarea_text_color="white",
|
88 |
+
textarea_padding="*spacing_md",
|
89 |
+
textarea_radius="6px",
|
90 |
+
textarea_border_width="1px",
|
91 |
+
|
92 |
+
# Layout
|
93 |
+
layout_gap="*spacing_lg",
|
94 |
+
block_label_padding="*spacing_sm *spacing_lg",
|
95 |
+
block_label_radius="6px",
|
96 |
+
block_label_border_width="1px",
|
97 |
+
block_label_border_color="#333",
|
98 |
+
block_label_background_fill="#151515",
|
99 |
)
|
100 |
|
101 |
|
|
|
110 |
fn=your_function,
|
111 |
inputs=gr.Textbox(),
|
112 |
outputs=gr.Textbox(),
|
113 |
+
theme=Modern(),
|
114 |
title="Test App",
|
115 |
)
|
116 |
|