andromeda01111 commited on
Commit
fe569d8
·
verified ·
1 Parent(s): e34e966

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -124,9 +124,15 @@ with gr.Blocks() as demo:
124
 
125
  # Toggle input fields based on model selection
126
  def toggle_inputs(choice):
127
- return gr.update(visible=(choice == "ViT")), gr.update(visible=(choice == "Neural Network"))
 
 
 
 
 
128
 
129
  model_selector.change(toggle_inputs, model_selector, [image_input, *feature_inputs])
 
130
  example_btn_1.click(lambda: fill_example(benign_example), None, feature_inputs)
131
  example_btn_2.click(lambda: fill_example(malignant_example), None, feature_inputs)
132
 
 
124
 
125
  # Toggle input fields based on model selection
126
  def toggle_inputs(choice):
127
+ """Toggle visibility of inputs based on model selection."""
128
+ image_visibility = choice == "ViT"
129
+ feature_visibility = choice == "Neural Network"
130
+
131
+ return [gr.update(visible=image_visibility)] + [gr.update(visible=feature_visibility)] * len(feature_inputs)
132
+
133
 
134
  model_selector.change(toggle_inputs, model_selector, [image_input, *feature_inputs])
135
+
136
  example_btn_1.click(lambda: fill_example(benign_example), None, feature_inputs)
137
  example_btn_2.click(lambda: fill_example(malignant_example), None, feature_inputs)
138