Update app.py
Browse files
app.py
CHANGED
@@ -148,16 +148,16 @@
|
|
148 |
|
149 |
# import gradio as gr
|
150 |
|
151 |
-
|
152 |
-
#
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
|
160 |
-
|
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(
|
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 |
|