Update app.py
Browse files
app.py
CHANGED
@@ -158,7 +158,7 @@ def update_options(selected_option):
|
|
158 |
new_options = ["Suboption 3.1", "Suboption 3.2"]
|
159 |
|
160 |
# Return the new options to update the second dropdown
|
161 |
-
return new_options
|
162 |
|
163 |
with gr.Blocks() as demo:
|
164 |
with gr.Row():
|
@@ -166,6 +166,6 @@ with gr.Blocks() as demo:
|
|
166 |
dropdown_2 = gr.Dropdown([], label="Sub Options")
|
167 |
|
168 |
# When the first dropdown changes, update the options in the second dropdown
|
169 |
-
dropdown_1.change(fn=update_options, inputs=dropdown_1, outputs=
|
170 |
|
171 |
demo.launch()
|
|
|
158 |
new_options = ["Suboption 3.1", "Suboption 3.2"]
|
159 |
|
160 |
# Return the new options to update the second dropdown
|
161 |
+
return new_options # Return current selection to persist it in the first dropdown
|
162 |
|
163 |
with gr.Blocks() as demo:
|
164 |
with gr.Row():
|
|
|
166 |
dropdown_2 = gr.Dropdown([], label="Sub Options")
|
167 |
|
168 |
# When the first dropdown changes, update the options in the second dropdown
|
169 |
+
dropdown_1.change(fn=update_options, inputs=dropdown_1, outputs=dropdown_2)
|
170 |
|
171 |
demo.launch()
|