Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -265,7 +265,8 @@ if __name__ == "__main__":
|
|
| 265 |
interactive=True,
|
| 266 |
)
|
| 267 |
generate_mask_btn_video = gr.Button("1οΈβ£ Generate Mask", visible=True, variant="primary")
|
| 268 |
-
gr.Examples([f"./demo/videos/{i+1}.mp4" for i in range(4)], inputs=video_input, label="Examples")
|
|
|
|
| 269 |
|
| 270 |
with gr.Column():
|
| 271 |
mode_video = gr.Radio(label="Mode", choices=["QA", "Seg"], value="QA")
|
|
@@ -304,6 +305,8 @@ if __name__ == "__main__":
|
|
| 304 |
*[gr.update(visible=False) for _ in range(4)],
|
| 305 |
[],
|
| 306 |
"Please segment the rubbish bin.",
|
|
|
|
|
|
|
| 307 |
)
|
| 308 |
|
| 309 |
def to_qa_mode():
|
|
@@ -311,6 +314,8 @@ if __name__ == "__main__":
|
|
| 311 |
*[gr.update(visible=True) for _ in range(4)],
|
| 312 |
[],
|
| 313 |
"What's the function of <object0>?",
|
|
|
|
|
|
|
| 314 |
)
|
| 315 |
|
| 316 |
def on_mode_change(mode):
|
|
@@ -318,7 +323,7 @@ if __name__ == "__main__":
|
|
| 318 |
return to_qa_mode()
|
| 319 |
return to_seg_mode()
|
| 320 |
|
| 321 |
-
mode_video.change(on_mode_change, inputs=[mode_video], outputs=[frame_idx, selected_frame, generate_mask_btn_video, response_video, mask_output_video, query_video])
|
| 322 |
video_input.change(on_video_upload, inputs=[video_input, fps, max_frames], outputs=[frames, timestamps, selected_frame, frame_idx])
|
| 323 |
frame_idx.change(on_frame_idx_change, inputs=[frame_idx, frames], outputs=[selected_frame])
|
| 324 |
|
|
|
|
| 265 |
interactive=True,
|
| 266 |
)
|
| 267 |
generate_mask_btn_video = gr.Button("1οΈβ£ Generate Mask", visible=True, variant="primary")
|
| 268 |
+
qa_examples = gr.Examples([f"./demo/videos/{i+1}.mp4" for i in range(4)], inputs=video_input, label="Examples")
|
| 269 |
+
seg_examples = gr.Examples([f"./demo/videos/{i+1}.mp4" for i in range(4,7)], inputs=video_input, label="Examples", visible=False)
|
| 270 |
|
| 271 |
with gr.Column():
|
| 272 |
mode_video = gr.Radio(label="Mode", choices=["QA", "Seg"], value="QA")
|
|
|
|
| 305 |
*[gr.update(visible=False) for _ in range(4)],
|
| 306 |
[],
|
| 307 |
"Please segment the rubbish bin.",
|
| 308 |
+
gr.update(visible=False),
|
| 309 |
+
gr.update(visible=True),
|
| 310 |
)
|
| 311 |
|
| 312 |
def to_qa_mode():
|
|
|
|
| 314 |
*[gr.update(visible=True) for _ in range(4)],
|
| 315 |
[],
|
| 316 |
"What's the function of <object0>?",
|
| 317 |
+
gr.update(visible=True),
|
| 318 |
+
gr.update(visible=False),
|
| 319 |
)
|
| 320 |
|
| 321 |
def on_mode_change(mode):
|
|
|
|
| 323 |
return to_qa_mode()
|
| 324 |
return to_seg_mode()
|
| 325 |
|
| 326 |
+
mode_video.change(on_mode_change, inputs=[mode_video], outputs=[frame_idx, selected_frame, generate_mask_btn_video, response_video, mask_output_video, query_video, qa_examples, seg_examples])
|
| 327 |
video_input.change(on_video_upload, inputs=[video_input, fps, max_frames], outputs=[frames, timestamps, selected_frame, frame_idx])
|
| 328 |
frame_idx.change(on_frame_idx_change, inputs=[frame_idx, frames], outputs=[selected_frame])
|
| 329 |
|