harishB97 commited on
Commit
96ada74
·
verified ·
1 Parent(s): a96c2c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -11
app.py CHANGED
@@ -148,16 +148,15 @@
148
 
149
  # import gradio as gr
150
 
151
- def update_options(selected_option):
152
- if selected_option == "Option 1":
153
- new_options = ["Suboption 1.1", "Suboption 1.2"]
154
- elif selected_option == "Option 2":
155
- new_options = ["Suboption 2.1", "Suboption 2.2"]
156
- else:
157
- new_options = ["Suboption 3.1", "Suboption 3.2"]
158
- new_options = [selected_option, 'Something', 'something else']
159
- new_options = 'something else'
160
- return new_options # Return current selection to persist it in the first dropdown
161
 
162
  # with gr.Blocks() as demo:
163
  # with gr.Row():
@@ -189,13 +188,18 @@ def update_options(selected_option):
189
  import gradio as gr
190
  import time
191
 
 
 
 
 
192
  with gr.Blocks() as interface:
193
  dropdown = gr.Dropdown(choices=["Anna", "Christine", "Phoebe"])
194
  dropdown2 = gr.Dropdown(choices=["Anna", "Christine", "Phoebe"])
195
  btn = gr.Button("Trigger!")
196
 
197
  btn.click(lambda: "Phoebe", None, dropdown)
198
- dropdown.change(update_options, dropdown, dropdown2)
 
199
 
200
  interface.launch()
201
 
 
148
 
149
  # import gradio as gr
150
 
151
+ # def update_options(selected_option):
152
+ # if selected_option == "Option 1":
153
+ # new_options = ["Suboption 1.1", "Suboption 1.2"]
154
+ # elif selected_option == "Option 2":
155
+ # new_options = ["Suboption 2.1", "Suboption 2.2"]
156
+ # else:
157
+ # new_options = ["Suboption 3.1", "Suboption 3.2"]
158
+ # new_options = [selected_option, 'Something', 'something else']
159
+ # return new_options # Return current selection to persist it in the first dropdown
 
160
 
161
  # with gr.Blocks() as demo:
162
  # with gr.Row():
 
188
  import gradio as gr
189
  import time
190
 
191
+ def update_options(selected_option):
192
+ new_options = [selected_option, 'Something', 'something else']
193
+ return new_options # Return current selection to persist it in the first dropdown
194
+
195
  with gr.Blocks() as interface:
196
  dropdown = gr.Dropdown(choices=["Anna", "Christine", "Phoebe"])
197
  dropdown2 = gr.Dropdown(choices=["Anna", "Christine", "Phoebe"])
198
  btn = gr.Button("Trigger!")
199
 
200
  btn.click(lambda: "Phoebe", None, dropdown)
201
+ # dropdown.change(update_options, dropdown, dropdown2)
202
+ dropdown.change(lambda x: x, dropdown, dropdown2)
203
 
204
  interface.launch()
205