Respair commited on
Commit
12b01be
·
verified ·
1 Parent(s): 3f5d79b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +155 -10
app.py CHANGED
@@ -6,7 +6,7 @@ from gradio.themes.utils.theme_dropdown import create_theme_dropdown
6
  dropdown, js = create_theme_dropdown()
7
 
8
  with gr.Blocks(theme='Respair/[email protected]') as demo:
9
- with gr.Row().style(equal_height=True):
10
  with gr.Column(scale=10):
11
  gr.Markdown(
12
  """
@@ -18,7 +18,7 @@ with gr.Blocks(theme='Respair/[email protected]') as demo:
18
  with gr.Column(scale=3):
19
  with gr.Box():
20
  dropdown.render()
21
- toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True)
22
 
23
  dropdown.change(None, dropdown, None, _js=js)
24
  toggle_dark.click(
@@ -64,7 +64,7 @@ with gr.Blocks(theme='Respair/[email protected]') as demo:
64
  img = gr.Image(
65
  "https://i.ibb.co/ydPm3n8/download-12-0.webp",
66
  label="Image",
67
- ).style(height=320)
68
  with gr.Row():
69
  go_btn = gr.Button("Go", label="Primary Button", variant="primary")
70
  clear_btn = gr.Button(
@@ -84,12 +84,9 @@ with gr.Blocks(theme='Respair/[email protected]') as demo:
84
  clear_btn.click(clear, None, img)
85
 
86
  with gr.Row():
87
- btn1 = gr.Button("Button 1").style(size="sm")
88
- btn2 = gr.UploadButton().style(size="sm")
89
- stop_btn = gr.Button("Stop", label="Stop Button", variant="stop").style(
90
- size="sm"
91
- )
92
-
93
  with gr.Row():
94
  gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
95
  gr.JSON(
@@ -115,7 +112,7 @@ with gr.Blocks(theme='Respair/[email protected]') as demo:
115
  "tower",
116
  ),
117
  ]
118
- ).style(height="200px", grid=2)
119
 
120
  with gr.Row():
121
  with gr.Column(scale=2):
@@ -143,3 +140,151 @@ with gr.Blocks(theme='Respair/[email protected]') as demo:
143
 
144
  if __name__ == "__main__":
145
  demo.queue().launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  dropdown, js = create_theme_dropdown()
7
 
8
  with gr.Blocks(theme='Respair/[email protected]') as demo:
9
+ with gr.Row():
10
  with gr.Column(scale=10):
11
  gr.Markdown(
12
  """
 
18
  with gr.Column(scale=3):
19
  with gr.Box():
20
  dropdown.render()
21
+ toggle_dark = gr.Button(value="Toggle Dark")
22
 
23
  dropdown.change(None, dropdown, None, _js=js)
24
  toggle_dark.click(
 
64
  img = gr.Image(
65
  "https://i.ibb.co/ydPm3n8/download-12-0.webp",
66
  label="Image",
67
+ )
68
  with gr.Row():
69
  go_btn = gr.Button("Go", label="Primary Button", variant="primary")
70
  clear_btn = gr.Button(
 
84
  clear_btn.click(clear, None, img)
85
 
86
  with gr.Row():
87
+ btn1 = gr.Button("Button 1")
88
+ btn2 = gr.UploadButton()
89
+ stop_btn = gr.Button("Stop", label="Stop Button", variant="stop")
 
 
 
90
  with gr.Row():
91
  gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
92
  gr.JSON(
 
112
  "tower",
113
  ),
114
  ]
115
+ )
116
 
117
  with gr.Row():
118
  with gr.Column(scale=2):
 
140
 
141
  if __name__ == "__main__":
142
  demo.queue().launch()
143
+
144
+
145
+ # import time
146
+
147
+ # import gradio as gr
148
+ # from gradio.themes.utils.theme_dropdown import create_theme_dropdown
149
+
150
+ # dropdown, js = create_theme_dropdown()
151
+
152
+ # with gr.Blocks(theme='Respair/[email protected]') as demo:
153
+ # with gr.Row().style(equal_height=True):
154
+ # with gr.Column(scale=10):
155
+ # gr.Markdown(
156
+ # """
157
+ # # Theme preview: `Shiki`
158
+ # To use this theme, set `theme='Respair/[email protected]'` or `theme='Respair/[email protected]'` in `gr.Blocks()` or `gr.Interface()`.
159
+ # of this theme.
160
+ # """
161
+ # )
162
+ # with gr.Column(scale=3):
163
+ # with gr.Box():
164
+ # dropdown.render()
165
+ # toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True)
166
+
167
+ # dropdown.change(None, dropdown, None, _js=js)
168
+ # toggle_dark.click(
169
+ # None,
170
+ # _js="""
171
+ # () => {
172
+ # document.body.classList.toggle('dark');
173
+ # }
174
+ # """,
175
+ # )
176
+
177
+ # name = gr.Textbox(
178
+ # label="Name",
179
+ # info="Full name, including middle name. No special characters.",
180
+ # placeholder="John Doe",
181
+ # value="John Doe",
182
+ # interactive=True,
183
+ # )
184
+
185
+ # with gr.Row():
186
+ # slider1 = gr.Slider(label="Slider 1")
187
+ # slider2 = gr.Slider(label="Slider 2")
188
+ # gr.CheckboxGroup(["A", "B", "C"], label="Checkbox Group")
189
+
190
+ # with gr.Row():
191
+ # with gr.Column(variant="panel", scale=1):
192
+ # gr.Markdown("## Panel 1")
193
+ # radio = gr.Radio(
194
+ # ["A", "B", "C"],
195
+ # label="Radio",
196
+ # 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.",
197
+ # )
198
+ # drop = gr.Dropdown(["Option 1", "Option 2", "Option 3"], show_label=False)
199
+ # drop_2 = gr.Dropdown(
200
+ # ["Option A", "Option B", "Option C"],
201
+ # multiselect=True,
202
+ # value=["Option A"],
203
+ # label="Dropdown",
204
+ # interactive=True,
205
+ # )
206
+ # check = gr.Checkbox(label="Go")
207
+ # with gr.Column(variant="panel", scale=2):
208
+ # img = gr.Image(
209
+ # "https://i.ibb.co/ydPm3n8/download-12-0.webp",
210
+ # label="Image",
211
+ # ).style(height=320)
212
+ # with gr.Row():
213
+ # go_btn = gr.Button("Go", label="Primary Button", variant="primary")
214
+ # clear_btn = gr.Button(
215
+ # "Clear", label="Secondary Button", variant="secondary"
216
+ # )
217
+
218
+ # def go(*args):
219
+ # time.sleep(3)
220
+ # return "https://i.ibb.co/ydPm3n8/download-12-0.webp"
221
+
222
+ # go_btn.click(go, [radio, drop, drop_2, check, name], img, api_name="go")
223
+
224
+ # def clear():
225
+ # time.sleep(0.2)
226
+ # return None
227
+
228
+ # clear_btn.click(clear, None, img)
229
+
230
+ # with gr.Row():
231
+ # btn1 = gr.Button("Button 1").style(size="sm")
232
+ # btn2 = gr.UploadButton().style(size="sm")
233
+ # stop_btn = gr.Button("Stop", label="Stop Button", variant="stop").style(
234
+ # size="sm"
235
+ # )
236
+
237
+ # with gr.Row():
238
+ # gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
239
+ # gr.JSON(
240
+ # value={"a": 1, "b": 2, "c": {"test": "a", "test2": [1, 2, 3]}}, label="JSON"
241
+ # )
242
+ # gr.Label(value={"cat": 0.7, "dog": 0.2, "fish": 0.1})
243
+ # gr.File()
244
+ # with gr.Row():
245
+ # gr.ColorPicker()
246
+ # gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4")
247
+ # gr.Gallery(
248
+ # [
249
+ # (
250
+ # "https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg",
251
+ # "lion",
252
+ # ),
253
+ # (
254
+ # "https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png",
255
+ # "logo",
256
+ # ),
257
+ # (
258
+ # "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
259
+ # "tower",
260
+ # ),
261
+ # ]
262
+ # ).style(height="200px", grid=2)
263
+
264
+ # with gr.Row():
265
+ # with gr.Column(scale=2):
266
+ # chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
267
+ # chat_btn = gr.Button("Add messages")
268
+
269
+ # def chat(history):
270
+ # time.sleep(2)
271
+ # yield [["How are you?", "I am good."]]
272
+
273
+ # chat_btn.click(
274
+ # lambda history: history
275
+ # + [["How are you?", "I am good."]]
276
+ # + (time.sleep(2) or []),
277
+ # chatbot,
278
+ # chatbot,
279
+ # )
280
+ # with gr.Column(scale=1):
281
+ # with gr.Accordion("Advanced Settings"):
282
+ # gr.Markdown("Hello")
283
+ # gr.Number(label="Chatbot control 1")
284
+ # gr.Number(label="Chatbot control 2")
285
+ # gr.Number(label="Chatbot control 3")
286
+
287
+
288
+ # if __name__ == "__main__":
289
+ # demo.queue().launch()
290
+