Spaces:
Runtime error
Runtime error
Besar
commited on
Commit
·
ac5a350
1
Parent(s):
b7c80c9
app.py
CHANGED
@@ -575,9 +575,7 @@ with gr.Blocks() as iface:
|
|
575 |
|
576 |
video_input.upload(
|
577 |
fn=get_frames_from_video,
|
578 |
-
inputs=[
|
579 |
-
video_input, video_state
|
580 |
-
],
|
581 |
outputs=[video_state, video_info, template_frame, image_selection_slider,
|
582 |
track_pause_number_slider,point_prompt, clear_button_click, Add_mask_button,
|
583 |
template_frame, tracking_video_predict_button, video_output, mask_dropdown,
|
@@ -586,9 +584,7 @@ with gr.Blocks() as iface:
|
|
586 |
|
587 |
extract_frames_button.click(
|
588 |
fn=get_frames_from_video,
|
589 |
-
inputs=[
|
590 |
-
video_input, video_state
|
591 |
-
],
|
592 |
outputs=[video_state, video_info, template_frame, image_selection_slider,
|
593 |
track_pause_number_slider,point_prompt, clear_button_click, Add_mask_button,
|
594 |
template_frame, tracking_video_predict_button, video_output, mask_dropdown,
|
@@ -610,41 +606,41 @@ with gr.Blocks() as iface:
|
|
610 |
template_frame.select(
|
611 |
fn=sam_refine,
|
612 |
inputs=[video_state, point_prompt, click_state, interactive_state],
|
613 |
-
outputs=[template_frame, video_state, interactive_state, run_status]
|
614 |
)
|
615 |
|
616 |
# add different mask
|
617 |
Add_mask_button.click(
|
618 |
fn=add_multi_mask,
|
619 |
inputs=[video_state, interactive_state, mask_dropdown],
|
620 |
-
outputs=[interactive_state, mask_dropdown, template_frame, click_state, run_status]
|
621 |
)
|
622 |
|
623 |
remove_mask_button.click(
|
624 |
fn=remove_multi_mask,
|
625 |
inputs=[interactive_state, mask_dropdown],
|
626 |
-
outputs=[interactive_state, mask_dropdown, run_status]
|
627 |
)
|
628 |
|
629 |
# tracking video from select image and mask
|
630 |
tracking_video_predict_button.click(
|
631 |
fn=vos_tracking_video,
|
632 |
inputs=[video_state, interactive_state, mask_dropdown],
|
633 |
-
outputs=[video_output, video_state, interactive_state, run_status]
|
634 |
)
|
635 |
|
636 |
# inpaint video from select image and mask
|
637 |
inpaint_video_predict_button.click(
|
638 |
fn=inpaint_video,
|
639 |
inputs=[video_state, interactive_state, mask_dropdown],
|
640 |
-
outputs=[video_output, run_status]
|
641 |
)
|
642 |
|
643 |
# click to get mask
|
644 |
mask_dropdown.change(
|
645 |
fn=show_mask,
|
646 |
inputs=[video_state, interactive_state, mask_dropdown],
|
647 |
-
outputs=[template_frame, run_status]
|
648 |
)
|
649 |
|
650 |
# clear input
|
@@ -699,7 +695,7 @@ with gr.Blocks() as iface:
|
|
699 |
clear_button_click.click(
|
700 |
fn = clear_click,
|
701 |
inputs = [video_state, click_state,],
|
702 |
-
outputs = [template_frame,click_state, run_status],
|
703 |
)
|
704 |
iface.queue(concurrency_count=1)
|
705 |
# iface.launch(debug=True, enable_queue=True, server_port=args.port, server_name="0.0.0.0")
|
|
|
575 |
|
576 |
video_input.upload(
|
577 |
fn=get_frames_from_video,
|
578 |
+
inputs=[video_input, video_state],
|
|
|
|
|
579 |
outputs=[video_state, video_info, template_frame, image_selection_slider,
|
580 |
track_pause_number_slider,point_prompt, clear_button_click, Add_mask_button,
|
581 |
template_frame, tracking_video_predict_button, video_output, mask_dropdown,
|
|
|
584 |
|
585 |
extract_frames_button.click(
|
586 |
fn=get_frames_from_video,
|
587 |
+
inputs=[video_input, video_state],
|
|
|
|
|
588 |
outputs=[video_state, video_info, template_frame, image_selection_slider,
|
589 |
track_pause_number_slider,point_prompt, clear_button_click, Add_mask_button,
|
590 |
template_frame, tracking_video_predict_button, video_output, mask_dropdown,
|
|
|
606 |
template_frame.select(
|
607 |
fn=sam_refine,
|
608 |
inputs=[video_state, point_prompt, click_state, interactive_state],
|
609 |
+
outputs=[template_frame, video_state, interactive_state, run_status], api_name="sam_refine"
|
610 |
)
|
611 |
|
612 |
# add different mask
|
613 |
Add_mask_button.click(
|
614 |
fn=add_multi_mask,
|
615 |
inputs=[video_state, interactive_state, mask_dropdown],
|
616 |
+
outputs=[interactive_state, mask_dropdown, template_frame, click_state, run_status], api_name="add_multi_mask"
|
617 |
)
|
618 |
|
619 |
remove_mask_button.click(
|
620 |
fn=remove_multi_mask,
|
621 |
inputs=[interactive_state, mask_dropdown],
|
622 |
+
outputs=[interactive_state, mask_dropdown, run_status], api_name="remove_multi_mask"
|
623 |
)
|
624 |
|
625 |
# tracking video from select image and mask
|
626 |
tracking_video_predict_button.click(
|
627 |
fn=vos_tracking_video,
|
628 |
inputs=[video_state, interactive_state, mask_dropdown],
|
629 |
+
outputs=[video_output, video_state, interactive_state, run_status], api_name="vos_tracking_video"
|
630 |
)
|
631 |
|
632 |
# inpaint video from select image and mask
|
633 |
inpaint_video_predict_button.click(
|
634 |
fn=inpaint_video,
|
635 |
inputs=[video_state, interactive_state, mask_dropdown],
|
636 |
+
outputs=[video_output, run_status], api_name="inpaint_video"
|
637 |
)
|
638 |
|
639 |
# click to get mask
|
640 |
mask_dropdown.change(
|
641 |
fn=show_mask,
|
642 |
inputs=[video_state, interactive_state, mask_dropdown],
|
643 |
+
outputs=[template_frame, run_status], api_name="show_mask"
|
644 |
)
|
645 |
|
646 |
# clear input
|
|
|
695 |
clear_button_click.click(
|
696 |
fn = clear_click,
|
697 |
inputs = [video_state, click_state,],
|
698 |
+
outputs = [template_frame,click_state, run_status], api_name="clear_click"
|
699 |
)
|
700 |
iface.queue(concurrency_count=1)
|
701 |
# iface.launch(debug=True, enable_queue=True, server_port=args.port, server_name="0.0.0.0")
|
appy.py
CHANGED
@@ -5,6 +5,6 @@ client = Client("https://besarismaili-track-anything.hf.space/")
|
|
5 |
video_url = "https://github.com/besarismaili/track-anything/raw/main/video_001.mp4"
|
6 |
|
7 |
result = client.predict(video_url, api_name="/api_extract_frames")
|
8 |
-
|
9 |
#print(client.config)
|
10 |
-
print(
|
|
|
5 |
video_url = "https://github.com/besarismaili/track-anything/raw/main/video_001.mp4"
|
6 |
|
7 |
result = client.predict(video_url, api_name="/api_extract_frames")
|
8 |
+
predictions = client.deserialize(result)
|
9 |
#print(client.config)
|
10 |
+
print(predictions)
|