Spaces:
Sleeping
Sleeping
digitalhigh
commited on
Commit
•
d7cbc79
1
Parent(s):
3d59cee
Updating theme
Browse files- README.md +10 -5
- app.py +144 -0
- themes/[email protected] +1 -0
README.md
CHANGED
@@ -1,12 +1,17 @@
|
|
|
|
1 |
---
|
2 |
-
|
3 |
-
|
4 |
-
colorFrom:
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.15.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
1 |
+
|
2 |
---
|
3 |
+
tags: [gradio-theme]
|
4 |
+
title: material_design_blue
|
5 |
+
colorFrom: red
|
6 |
colorTo: purple
|
7 |
sdk: gradio
|
8 |
sdk_version: 4.15.0
|
9 |
app_file: app.py
|
10 |
pinned: false
|
11 |
+
license: apache-2.0
|
12 |
---
|
13 |
+
# material_design_blue
|
14 |
+
## Description
|
15 |
+
Add a description of this theme here!
|
16 |
+
## Contributions
|
17 |
+
Thanks to [@digitalhigh](https://huggingface.co/digitalhigh) for adding this gradio theme!
|
app.py
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import time
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
from gradio.themes.utils.theme_dropdown import create_theme_dropdown
|
5 |
+
|
6 |
+
dropdown, js = create_theme_dropdown()
|
7 |
+
|
8 |
+
with gr.Blocks(theme='d8ahazard/material_design_blue') as demo:
|
9 |
+
with gr.Row(equal_height=True):
|
10 |
+
with gr.Column(scale=10):
|
11 |
+
gr.Markdown(
|
12 |
+
"""
|
13 |
+
# Theme preview: `material_design_blue`
|
14 |
+
To use this theme, set `theme='d8ahazard/material_design_blue'` in `gr.Blocks()` or `gr.Interface()`.
|
15 |
+
You can append an `@` and a semantic version expression, e.g. @>=1.0.0,<2.0.0 to pin to a given version
|
16 |
+
of this theme.
|
17 |
+
"""
|
18 |
+
)
|
19 |
+
with gr.Column(scale=3):
|
20 |
+
with gr.Group():
|
21 |
+
dropdown.render()
|
22 |
+
toggle_dark = gr.Button(value="Toggle Dark")
|
23 |
+
|
24 |
+
dropdown.change(None, dropdown, None, js=js)
|
25 |
+
toggle_dark.click(
|
26 |
+
None,
|
27 |
+
js="""
|
28 |
+
() => {
|
29 |
+
document.body.classList.toggle('dark');
|
30 |
+
}
|
31 |
+
""",
|
32 |
+
)
|
33 |
+
|
34 |
+
name = gr.Textbox(
|
35 |
+
label="Name",
|
36 |
+
info="Full name, including middle name. No special characters.",
|
37 |
+
placeholder="John Doe",
|
38 |
+
value="John Doe",
|
39 |
+
interactive=True,
|
40 |
+
)
|
41 |
+
|
42 |
+
with gr.Row():
|
43 |
+
slider1 = gr.Slider(label="Slider 1")
|
44 |
+
slider2 = gr.Slider(label="Slider 2")
|
45 |
+
gr.CheckboxGroup(["A", "B", "C"], label="Checkbox Group")
|
46 |
+
|
47 |
+
with gr.Row():
|
48 |
+
with gr.Column(variant="panel", scale=1):
|
49 |
+
gr.Markdown("## Panel 1")
|
50 |
+
radio = gr.Radio(
|
51 |
+
["A", "B", "C"],
|
52 |
+
label="Radio",
|
53 |
+
info="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
54 |
+
)
|
55 |
+
drop = gr.Dropdown(["Option 1", "Option 2", "Option 3"], show_label=False)
|
56 |
+
drop_2 = gr.Dropdown(
|
57 |
+
["Option A", "Option B", "Option C"],
|
58 |
+
multiselect=True,
|
59 |
+
value=["Option A"],
|
60 |
+
label="Dropdown",
|
61 |
+
interactive=True,
|
62 |
+
)
|
63 |
+
check = gr.Checkbox(label="Go")
|
64 |
+
with gr.Column(variant="panel", scale=2):
|
65 |
+
img = gr.Image(
|
66 |
+
"https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpg",
|
67 |
+
label="Image",
|
68 |
+
height=320,
|
69 |
+
)
|
70 |
+
with gr.Row():
|
71 |
+
go_btn = gr.Button("Go", variant="primary")
|
72 |
+
clear_btn = gr.Button("Clear", variant="secondary")
|
73 |
+
|
74 |
+
def go(*args):
|
75 |
+
time.sleep(3)
|
76 |
+
return "https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpg"
|
77 |
+
|
78 |
+
go_btn.click(go, [radio, drop, drop_2, check, name], img, api_name="go")
|
79 |
+
|
80 |
+
def clear():
|
81 |
+
time.sleep(0.2)
|
82 |
+
return None
|
83 |
+
|
84 |
+
clear_btn.click(clear, None, img)
|
85 |
+
|
86 |
+
with gr.Row():
|
87 |
+
btn1 = gr.Button("Button 1", size="sm")
|
88 |
+
btn2 = gr.UploadButton(size="sm")
|
89 |
+
stop_btn = gr.Button("Stop", size="sm", variant="stop")
|
90 |
+
|
91 |
+
with gr.Row():
|
92 |
+
gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
|
93 |
+
gr.JSON(
|
94 |
+
value={"a": 1, "b": 2, "c": {"test": "a", "test2": [1, 2, 3]}}, label="JSON"
|
95 |
+
)
|
96 |
+
gr.Label(value={"cat": 0.7, "dog": 0.2, "fish": 0.1})
|
97 |
+
gr.File()
|
98 |
+
with gr.Row():
|
99 |
+
gr.ColorPicker()
|
100 |
+
gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4")
|
101 |
+
gr.Gallery(
|
102 |
+
[
|
103 |
+
(
|
104 |
+
"https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg",
|
105 |
+
"lion",
|
106 |
+
),
|
107 |
+
(
|
108 |
+
"https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png",
|
109 |
+
"logo",
|
110 |
+
),
|
111 |
+
(
|
112 |
+
"https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
|
113 |
+
"tower",
|
114 |
+
),
|
115 |
+
],
|
116 |
+
height=200,
|
117 |
+
)
|
118 |
+
|
119 |
+
with gr.Row():
|
120 |
+
with gr.Column(scale=2):
|
121 |
+
chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
|
122 |
+
chat_btn = gr.Button("Add messages")
|
123 |
+
|
124 |
+
def chat(history):
|
125 |
+
time.sleep(2)
|
126 |
+
yield [["How are you?", "I am good."]]
|
127 |
+
|
128 |
+
chat_btn.click(
|
129 |
+
lambda history: history
|
130 |
+
+ [["How are you?", "I am good."]]
|
131 |
+
+ (time.sleep(2) or []),
|
132 |
+
chatbot,
|
133 |
+
chatbot,
|
134 |
+
)
|
135 |
+
with gr.Column(scale=1):
|
136 |
+
with gr.Accordion("Advanced Settings"):
|
137 |
+
gr.Markdown("Hello")
|
138 |
+
gr.Number(label="Chatbot control 1")
|
139 |
+
gr.Number(label="Chatbot control 2")
|
140 |
+
gr.Number(label="Chatbot control 3")
|
141 |
+
|
142 |
+
|
143 |
+
if __name__ == "__main__":
|
144 |
+
demo.queue().launch()
|
themes/[email protected]
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"theme": {"_font": [{"__gradio_font__": true, "name": "Roboto", "class": "google"}], "_font_mono": [{"__gradio_font__": true, "name": "IBM Plex Mono", "class": "google"}], "_stylesheets": ["https://fonts.googleapis.com/css2?family=Roboto:wght@400;600&display=swap", "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"], "background_fill_primary": "#2f3335", "background_fill_primary_dark": "#2f3335", "background_fill_secondary": "#252628", "background_fill_secondary_dark": "#252628", "block_background_fill": "#2f3335", "block_background_fill_dark": "#252628", "block_border_color": "#193EAE", "block_border_color_dark": "#1976D2", "block_border_width": "1px", "block_border_width_dark": "1px", "block_info_text_color": "#FFFFFF", "block_info_text_color_dark": "#FFFFFF", "block_info_text_size": "14px", "block_info_text_weight": "300", "block_label_background_fill": "#193EAE", "block_label_background_fill_dark": "#193EAE", "block_label_border_color": "#193EAE", "block_label_border_color_dark": "#1976D2", "block_label_border_width": "1px", "block_label_border_width_dark": "1px", "block_label_margin": "8px", "block_label_padding": "4px 8px", "block_label_radius": "8px", "block_label_right_radius": "8px", "block_label_shadow": "0 2px 4px rgba(0,0,0,0.5)", "block_label_text_color": "#FFFFFF", "block_label_text_color_dark": "#FFFFFF", "block_label_text_size": "14px", "block_label_text_weight": "300", "block_padding": "4px 8px", "block_radius": "12px", "block_shadow": "0 2px 4px rgba(0,0,0,0.5)", "block_shadow_dark": "0 2px 4px rgba(0,0,0,0.5)", "block_title_background_fill": "#193EAE", "block_title_background_fill_dark": "#193EAE", "block_title_border_color": "#193EAE", "block_title_border_color_dark": "#1976D2", "block_title_border_width": "1px", "block_title_border_width_dark": "1px", "block_title_padding": "4px 8px", "block_title_radius": "12px", "block_title_text_color": "#FFFFFF", "block_title_text_color_dark": "#FFFFFF", "block_title_text_size": "14px", "block_title_text_weight": "300", "body_background_fill": "#121212", "body_background_fill_dark": "#121212", "body_text_color": "#FFFFFF", "body_text_color_dark": "#FFFFFF", "body_text_color_subdued": "#BBBBBB", "body_text_color_subdued_dark": "#BBBBBB", "body_text_size": "16px", "body_text_weight": "300", "border_color_accent": "#193EAE", "border_color_accent_dark": "#1976D2", "border_color_accent_subdued": "#FF8F00", "border_color_accent_subdued_dark": "#FF6F00", "border_color_primary": "#193EAE", "border_color_primary_dark": "#193EAE", "button_border_width": "2px", "button_border_width_dark": "2px", "button_cancel_background_fill": "#B71C1C", "button_cancel_background_fill_dark": "#A22F2F", "button_cancel_background_fill_hover": "#A22F2F", "button_cancel_background_fill_hover_dark": "#872017", "button_cancel_border_color": "#B71C1C", "button_cancel_border_color_dark": "#A22F2F", "button_cancel_border_color_hover": "#A22F2F", "button_cancel_border_color_hover_dark": "#872017", "button_cancel_text_color": "#FFFFFF", "button_cancel_text_color_dark": "#FFFFFF", "button_cancel_text_color_hover": "#FFFFFF", "button_cancel_text_color_hover_dark": "#FFFFFF", "button_large_padding": "6px 12px", "button_large_radius": "12px", "button_large_text_size": "16px", "button_large_text_weight": "600", "button_primary_background_fill": "#193EAE", "button_primary_background_fill_dark": "#1976D2", "button_primary_background_fill_hover": "#1976D2", "button_primary_background_fill_hover_dark": "#2189E6", "button_primary_border_color": "#193EAE", "button_primary_border_color_dark": "#1976D2", "button_primary_border_color_hover": "#2189E6", "button_primary_border_color_hover_dark": "#2189E6", "button_primary_text_color": "#FFFFFF", "button_primary_text_color_dark": "#FFFFFF", "button_primary_text_color_hover": "#FFFFFF", "button_primary_text_color_hover_dark": "#FFFFFF", "button_secondary_background_fill": "#FF8F00", "button_secondary_background_fill_dark": "#FF6F00", "button_secondary_background_fill_hover": "#FF6F00", "button_secondary_background_fill_hover_dark": "#FFA000", "button_secondary_border_color": "#FF8F00", "button_secondary_border_color_dark": "#FF6F00", "button_secondary_border_color_hover": "#FF6F00", "button_secondary_border_color_hover_dark": "#FFA000", "button_secondary_text_color": "#FFFFFF", "button_secondary_text_color_dark": "#FFFFFF", "button_secondary_text_color_hover": "#FFFFFF", "button_secondary_text_color_hover_dark": "#FFFFFF", "button_shadow": "0 2px 4px rgba(0,0,0,0.5)", "button_shadow_active": "0 2px 4px rgba(0,0,0,0.5)", "button_shadow_hover": "0 2px 4px rgba(0,0,0,0.5)", "button_small_padding": "4px 8px", "button_small_radius": "8px", "button_small_text_size": "14px", "button_small_text_weight": "600", "button_transition": "all 0.3s ease", "checkbox_background_color": "#FFFFFF", "checkbox_background_color_dark": "#252628", "checkbox_background_color_focus": "#193EAE", "checkbox_background_color_focus_dark": "#1976D2", "checkbox_background_color_hover": "#70AAFF", "checkbox_background_color_hover_dark": "#5894E6", "checkbox_background_color_selected": "#193EAE", "checkbox_background_color_selected_dark": "#1976D2", "checkbox_border_color": "#193EAE", "checkbox_border_color_dark": "#1976D2", "checkbox_border_color_focus": "#193EAE", "checkbox_border_color_focus_dark": "#1976D2", "checkbox_border_color_hover": "#70AAFF", "checkbox_border_color_hover_dark": "#5894E6", "checkbox_border_color_selected": "#193EAE", "checkbox_border_color_selected_dark": "#1976D2", "checkbox_border_radius": "8px", "checkbox_border_width": "2px", "checkbox_border_width_dark": "2px", "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\")", "checkbox_label_background_fill": "#FFFFFF", "checkbox_label_background_fill_dark": "#252628", "checkbox_label_background_fill_hover": "#70AAFF", "checkbox_label_background_fill_hover_dark": "#5894E6", "checkbox_label_background_fill_selected": "#FF8F00", "checkbox_label_background_fill_selected_dark": "#FF6F00", "checkbox_label_border_color": "#193EAE", "checkbox_label_border_color_dark": "#1976D2", "checkbox_label_border_color_hover": "#70AAFF", "checkbox_label_border_color_hover_dark": "#5894E6", "checkbox_label_border_width": "1px", "checkbox_label_border_width_dark": "1px", "checkbox_label_gap": "8px", "checkbox_label_padding": "4px 8px", "checkbox_label_shadow": "0 1px 2px rgba(0,0,0,0.3)", "checkbox_label_text_color": "#FFFFFF", "checkbox_label_text_color_dark": "#FFFFFF", "checkbox_label_text_color_selected": "#FFFFFF", "checkbox_label_text_color_selected_dark": "#FFFFFF", "checkbox_label_text_size": "14px", "checkbox_label_text_weight": "300", "checkbox_shadow": "0 1px 2px rgba(0,0,0,0.3)", "code_background_fill": "#2f3335", "code_background_fill_dark": "#252628", "color_accent": "#193EAE", "color_accent_soft": "#70AAFF", "color_accent_soft_dark": "#5894E6", "container_radius": "12px", "embed_radius": "12px", "error_background_fill": "#B71C1C", "error_background_fill_dark": "#A22F2F", "error_border_color": "#B71C1C", "error_border_color_dark": "#A22F2F", "error_border_width": "1px", "error_border_width_dark": "1px", "error_icon_color": "#FFFFFF", "error_icon_color_dark": "#FFFFFF", "error_text_color": "#FFFFFF", "error_text_color_dark": "#FFFFFF", "font": "'Roboto'", "font_mono": "'IBM Plex Mono'", "form_gap_width": "10px", "input_background_fill": "#2f3335", "input_background_fill_dark": "#252628", "input_background_fill_focus": "#193EAE", "input_background_fill_focus_dark": "#1976D2", "input_background_fill_hover": "#70AAFF", "input_background_fill_hover_dark": "#5894E6", "input_border_color": "#193EAE", "input_border_color_dark": "#1976D2", "input_border_color_focus": "#193EAE", "input_border_color_focus_dark": "#1976D2", "input_border_color_hover": "#70AAFF", "input_border_color_hover_dark": "#5894E6", "input_border_width": "1px", "input_border_width_dark": "1px", "input_padding": "4px 8px", "input_placeholder_color": "#BBBBBB", "input_placeholder_color_dark": "#BBBBBB", "input_radius": "8px", "input_shadow": "0 2px 4px rgba(0,0,0,0.5)", "input_shadow_dark": "0 2px 4px rgba(0,0,0,0.5)", "input_shadow_focus": "0 2px 4px rgba(0,0,0,0.5)", "input_shadow_focus_dark": "0 2px 4px rgba(0,0,0,0.5)", "input_text_size": "14px", "input_text_weight": "300", "layout_gap": "10px", "link_text_color": "#193EAE", "link_text_color_active": "#193EAE", "link_text_color_active_dark": "#1976D2", "link_text_color_dark": "#1976D2", "link_text_color_hover": "#193EAE", "link_text_color_hover_dark": "#1976D2", "link_text_color_visited": "#193EAE", "link_text_color_visited_dark": "#1976D2", "loader_color": "#193EAE", "loader_color_dark": "#1976D2", "name": "base", "neutral_100": "#f3f4f6", "neutral_200": "#e5e7eb", "neutral_300": "#d1d5db", "neutral_400": "#9ca3af", "neutral_50": "#f9fafb", "neutral_500": "#6b7280", "neutral_600": "#4b5563", "neutral_700": "#374151", "neutral_800": "#1f2937", "neutral_900": "#111827", "neutral_950": "#0b0f19", "panel_background_fill": "#2f3335", "panel_background_fill_dark": "#252628", "panel_border_color": "#193EAE", "panel_border_color_dark": "#1976D2", "panel_border_width": "1px", "panel_border_width_dark": "1px", "primary_100": "#dbeafe", "primary_200": "#bfdbfe", "primary_300": "#93c5fd", "primary_400": "#60a5fa", "primary_50": "#eff6ff", "primary_500": "#3b82f6", "primary_600": "#2563eb", "primary_700": "#1d4ed8", "primary_800": "#1e40af", "primary_900": "#1e3a8a", "primary_950": "#1d3660", "prose_header_text_weight": "600", "prose_text_size": "16px", "prose_text_weight": "300", "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\")", "radius_lg": "12px", "radius_md": "8px", "radius_sm": "6px", "radius_xl": "16px", "radius_xs": "4px", "radius_xxl": "24px", "radius_xxs": "2px", "secondary_100": "#ccfbf1", "secondary_200": "#99f6e4", "secondary_300": "#5eead4", "secondary_400": "#2dd4bf", "secondary_50": "#f0fdfa", "secondary_500": "#14b8a6", "secondary_600": "#0d9488", "secondary_700": "#0f766e", "secondary_800": "#115e59", "secondary_900": "#134e4a", "secondary_950": "#12443e", "section_header_text_size": "18px", "section_header_text_weight": "600", "shadow_drop": "0 2px 4px rgba(0,0,0,0.5)", "shadow_drop_lg": "0 4px 8px rgba(0,0,0,0.5)", "shadow_inset": "inset 0 2px 4px rgba(0,0,0,0.2)", "shadow_spread": "0 1px 3px rgba(0,0,0,0.4)", "shadow_spread_dark": "0 1px 3px rgba(0,0,0,0.4)", "slider_color": "#193EAE", "slider_color_dark": "#193EAE", "spacing_lg": "8px", "spacing_md": "6px", "spacing_sm": "4px", "spacing_xl": "10px", "spacing_xs": "2px", "spacing_xxl": "16px", "spacing_xxs": "1px", "stat_background_fill": "#193EAE", "stat_background_fill_dark": "#193EAE", "table_border_color": "#193EAE", "table_border_color_dark": "#1976D2", "table_even_background_fill": "#2f3335", "table_even_background_fill_dark": "#252628", "table_odd_background_fill": "#2f3335", "table_odd_background_fill_dark": "#252628", "table_radius": "8px", "table_row_focus": "#193EAE", "table_row_focus_dark": "#1976D2", "text_lg": "16px", "text_md": "14px", "text_sm": "12px", "text_xl": "22px", "text_xs": "10px", "text_xxl": "26px", "text_xxs": "9px"}, "version": "0.0.1"}
|