harishB97 commited on
Commit
741e92f
·
verified ·
1 Parent(s): e5411ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -148,16 +148,16 @@
148
 
149
  # import gradio as gr
150
 
151
- # def update_options(selected_option):
152
- # # Logic to determine new options based on selected option
153
- # if selected_option == "Option 1":
154
- # new_options = ["Suboption 1.1", "Suboption 1.2"]
155
- # elif selected_option == "Option 2":
156
- # new_options = ["Suboption 2.1", "Suboption 2.2"]
157
- # else:
158
- # new_options = ["Suboption 3.1", "Suboption 3.2"]
159
 
160
- # new_options = ['Something', 'something else']
161
 
162
  # # Return the new options to update the second dropdown
163
  # return new_options # Return current selection to persist it in the first dropdown
@@ -198,7 +198,7 @@ with gr.Blocks() as interface:
198
  btn = gr.Button("Trigger!")
199
 
200
  btn.click(lambda: "Phoebe", None, dropdown)
201
- dropdown.change(lambda x: x, dropdown, dropdown2)
202
 
203
  interface.launch()
204
 
 
148
 
149
  # import gradio as gr
150
 
151
+ def update_options(selected_option):
152
+ # Logic to determine new options based on selected option
153
+ if selected_option == "Option 1":
154
+ new_options = ["Suboption 1.1", "Suboption 1.2"]
155
+ elif selected_option == "Option 2":
156
+ new_options = ["Suboption 2.1", "Suboption 2.2"]
157
+ else:
158
+ new_options = ["Suboption 3.1", "Suboption 3.2"]
159
 
160
+ new_options = [selected_option, 'Something', 'something else']
161
 
162
  # # Return the new options to update the second dropdown
163
  # return new_options # Return current selection to persist it in the first dropdown
 
198
  btn = gr.Button("Trigger!")
199
 
200
  btn.click(lambda: "Phoebe", None, dropdown)
201
+ dropdown.change(fn=update_options, dropdown, dropdown2)
202
 
203
  interface.launch()
204