Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -139,6 +139,12 @@ with gr.Blocks() as demo:
|
|
139 |
|
140 |
mode.change(toggle_inputs, inputs=mode, outputs=[media_upload, url])
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
run_det = gr.Checkbox(label="Object Detection")
|
144 |
run_seg = gr.Checkbox(label="Semantic Segmentation")
|
@@ -151,9 +157,9 @@ with gr.Blocks() as demo:
|
|
151 |
det_confidence = gr.Slider(0.1, 1.0, 0.5, label="Detection Confidence Threshold", visible=False)
|
152 |
|
153 |
# Attach Visibility Logic
|
154 |
-
run_det.change(
|
155 |
-
run_seg.change(toggle_visibility, inputs=[run_seg], outputs=[seg_model])
|
156 |
-
run_depth.change(toggle_visibility, inputs=[run_depth], outputs=[depth_model])
|
157 |
|
158 |
|
159 |
blend = gr.Slider(0.0, 1.0, 0.5, label="Overlay Blend")
|
|
|
139 |
|
140 |
mode.change(toggle_inputs, inputs=mode, outputs=[media_upload, url])
|
141 |
|
142 |
+
# Visibility logic function
|
143 |
+
def toggle_visibility(checked):
|
144 |
+
return [gr.update(visible=checked)]
|
145 |
+
|
146 |
+
def toggle_det_visibility(checked):
|
147 |
+
return [gr.update(visible=checked), gr.update(visible=checked)]
|
148 |
|
149 |
run_det = gr.Checkbox(label="Object Detection")
|
150 |
run_seg = gr.Checkbox(label="Semantic Segmentation")
|
|
|
157 |
det_confidence = gr.Slider(0.1, 1.0, 0.5, label="Detection Confidence Threshold", visible=False)
|
158 |
|
159 |
# Attach Visibility Logic
|
160 |
+
run_det.change(fn=toggle_det_visibility, inputs=[run_det], outputs=[det_model, det_confidence])
|
161 |
+
run_seg.change(fn=toggle_visibility, inputs=[run_seg], outputs=[seg_model])
|
162 |
+
run_depth.change(fn=toggle_visibility, inputs=[run_depth], outputs=[depth_model])
|
163 |
|
164 |
|
165 |
blend = gr.Slider(0.0, 1.0, 0.5, label="Overlay Blend")
|