Taithrah commited on
Commit
1f41c1e
·
verified ·
1 Parent(s): 2eea170

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -23
app.py CHANGED
@@ -19,12 +19,12 @@ with gr.Blocks(theme='Taithrah/Minimal') as demo:
19
  with gr.Column(scale=3):
20
  with gr.Group():
21
  dropdown.render()
22
- toggle_dark = gr.Button(value="Toggle Dark", scale=1)
23
 
24
- dropdown.change(lambda value: None, dropdown, None)
25
  toggle_dark.click(
26
  None,
27
- _js="""
28
  () => {
29
  document.body.classList.toggle('dark');
30
  }
@@ -65,31 +65,27 @@ with gr.Blocks(theme='Taithrah/Minimal') as demo:
65
  img = gr.Image(
66
  "https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpg",
67
  label="Image",
68
- ).style(height=320)
 
69
  with gr.Row():
70
- go_btn = gr.Button("Go", label="Primary Button", variant="primary")
71
- clear_btn = gr.Button(
72
- "Clear", label="Secondary Button", variant="secondary"
73
- )
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").style(size="sm")
89
- btn2 = gr.UploadButton().style(size="sm")
90
- stop_btn = gr.Button("Stop", label="Stop Button", variant="stop").style(
91
- size="sm"
92
- )
93
 
94
  with gr.Row():
95
  gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
@@ -115,18 +111,15 @@ with gr.Blocks(theme='Taithrah/Minimal') as demo:
115
  "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
116
  "tower",
117
  ),
118
- ]
119
- ).style(height="200px", grid=2)
 
120
 
121
  with gr.Row():
122
  with gr.Column(scale=2):
123
  chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
124
  chat_btn = gr.Button("Add messages")
125
 
126
- def chat(history):
127
- time.sleep(2)
128
- yield [["How are you?", "I am good."]]
129
-
130
  chat_btn.click(
131
  lambda history: history
132
  + [["How are you?", "I am good."]]
@@ -143,4 +136,4 @@ with gr.Blocks(theme='Taithrah/Minimal') as demo:
143
 
144
 
145
  if __name__ == "__main__":
146
- demo.queue().launch()
 
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
  }
 
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
 
83
  clear_btn.click(clear, None, img)
84
 
85
  with gr.Row():
86
+ btn1 = gr.Button("Button 1", size="sm")
87
+ btn2 = gr.UploadButton(size="sm")
88
+ stop_btn = gr.Button("Stop", size="sm", variant="stop")
 
 
89
 
90
  with gr.Row():
91
  gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
 
111
  "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
112
  "tower",
113
  ),
114
+ ],
115
+ height=200,
116
+ )
117
 
118
  with gr.Row():
119
  with gr.Column(scale=2):
120
  chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
121
  chat_btn = gr.Button("Add messages")
122
 
 
 
 
 
123
  chat_btn.click(
124
  lambda history: history
125
  + [["How are you?", "I am good."]]
 
136
 
137
 
138
  if __name__ == "__main__":
139
+ demo.queue().launch()