deepkyu commited on
Commit
36fbf0a
1 Parent(s): f04eea7

update commit

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. README.md +1 -1
  3. app_custom.py +147 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ *.sh
README.md CHANGED
@@ -7,7 +7,7 @@ colorTo: gray
7
  emoji: ⛔️
8
  sdk: gradio
9
  sdk_version: 4.13.0
10
- app_file: app.py
11
  pinned: false
12
  license: apache-2.0
13
  ---
 
7
  emoji: ⛔️
8
  sdk: gradio
9
  sdk_version: 4.13.0
10
+ app_file: app_custom.py
11
  pinned: false
12
  license: apache-2.0
13
  ---
app_custom.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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='deepkyu/compact-theme') as demo:
9
+ with gr.Row(equal_height=True):
10
+ with gr.Column(scale=10):
11
+ gr.Markdown(
12
+ """
13
+ # Theme preview: `compact-theme`
14
+ To use this theme, set `theme='deepkyu/compact-theme'` 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.Tab(label='Original'):
43
+ with gr.Row():
44
+ slider1 = gr.Slider(label="Slider 1")
45
+ slider2 = gr.Slider(label="Slider 2")
46
+ gr.CheckboxGroup(["A", "B", "C"], label="Checkbox Group")
47
+
48
+ with gr.Row():
49
+ with gr.Column(variant="panel", scale=1):
50
+ gr.Markdown("## Panel 1")
51
+ radio = gr.Radio(
52
+ ["A", "B", "C"],
53
+ label="Radio",
54
+ 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.",
55
+ )
56
+ drop = gr.Dropdown(["Option 1", "Option 2", "Option 3"], show_label=False)
57
+ drop_2 = gr.Dropdown(
58
+ ["Option A", "Option B", "Option C"],
59
+ multiselect=True,
60
+ value=["Option A"],
61
+ label="Dropdown",
62
+ interactive=True,
63
+ )
64
+ check = gr.Checkbox(label="Go")
65
+ with gr.Column(variant="panel", scale=2):
66
+ img = gr.Image(
67
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpg",
68
+ label="Image",
69
+ height=320,
70
+ )
71
+ with gr.Row():
72
+ go_btn = gr.Button("Go", variant="primary")
73
+ clear_btn = gr.Button("Clear", variant="secondary")
74
+
75
+ def go(*args):
76
+ time.sleep(3)
77
+ return "https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpgjpg"
78
+
79
+ go_btn.click(go, [radio, drop, drop_2, check, name], img, api_name="go")
80
+
81
+ def clear():
82
+ time.sleep(0.2)
83
+ return None
84
+
85
+ clear_btn.click(clear, None, img)
86
+
87
+ with gr.Row():
88
+ btn1 = gr.Button("Button 1", size="sm")
89
+ btn2 = gr.UploadButton(size="sm")
90
+ stop_btn = gr.Button("Stop", size="sm", variant="stop")
91
+
92
+ with gr.Row():
93
+ gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
94
+ gr.JSON(
95
+ value={"a": 1, "b": 2, "c": {"test": "a", "test2": [1, 2, 3]}}, label="JSON"
96
+ )
97
+ gr.Label(value={"cat": 0.7, "dog": 0.2, "fish": 0.1})
98
+ gr.File()
99
+ with gr.Row():
100
+ gr.ColorPicker()
101
+ gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4")
102
+ gr.Gallery(
103
+ [
104
+ (
105
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg",
106
+ "lion",
107
+ ),
108
+ (
109
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png",
110
+ "logo",
111
+ ),
112
+ (
113
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
114
+ "tower",
115
+ ),
116
+ ],
117
+ height=200,
118
+ )
119
+
120
+ with gr.Row():
121
+ with gr.Column(scale=2):
122
+ chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
123
+ chat_btn = gr.Button("Add messages")
124
+
125
+ def chat(history):
126
+ time.sleep(2)
127
+ yield [["How are you?", "I am good."]]
128
+
129
+ chat_btn.click(
130
+ lambda history: history
131
+ + [["How are you?", "I am good."]]
132
+ + (time.sleep(2) or []),
133
+ chatbot,
134
+ chatbot,
135
+ )
136
+ with gr.Column(scale=1):
137
+ with gr.Accordion("Advanced Settings"):
138
+ gr.Markdown("Hello")
139
+ gr.Number(label="Chatbot control 1")
140
+ gr.Number(label="Chatbot control 2")
141
+ gr.Number(label="Chatbot control 3")
142
+
143
+ with gr.Tab(label='New'):
144
+ pass
145
+
146
+ if __name__ == "__main__":
147
+ demo.queue().launch()