Spaces:
Runtime error
Runtime error
Besar
commited on
Commit
·
37d16f6
1
Parent(s):
711eefa
app.py
CHANGED
@@ -80,7 +80,11 @@ def download_video(video_url):
|
|
80 |
|
81 |
return video_path
|
82 |
|
83 |
-
|
|
|
|
|
|
|
|
|
84 |
|
85 |
# extract frames from upload video
|
86 |
def get_frames_from_video(video_input, video_state):
|
@@ -489,6 +493,7 @@ with gr.Blocks() as iface:
|
|
489 |
video_input = gr.Video(autosize=True)
|
490 |
with gr.Column():
|
491 |
video_info = gr.Textbox(label="Video Info")
|
|
|
492 |
resize_info = gr.Textbox(value="If you want to use the inpaint function, it is best to git clone the repo and use a machine with more VRAM locally. \
|
493 |
Alternatively, you can use the resize ratio slider to scale down the original image to around 360P resolution for faster processing.", label="Tips for running this demo.")
|
494 |
resize_ratio_slider = gr.Slider(minimum=0.02, maximum=1, step=0.02, value=0.6, label="Resize ratio", visible=True)
|
@@ -500,7 +505,7 @@ with gr.Blocks() as iface:
|
|
500 |
# extract frames
|
501 |
with gr.Column():
|
502 |
extract_frames_button = gr.Button(value="Get video info", interactive=True, variant="primary")
|
503 |
-
|
504 |
# click points settins, negative or positive, mode continuous or single
|
505 |
with gr.Row():
|
506 |
with gr.Row():
|
@@ -553,7 +558,10 @@ with gr.Blocks() as iface:
|
|
553 |
outputs=[video_demo_operation],
|
554 |
# cache_examples=True,
|
555 |
)
|
556 |
-
|
|
|
|
|
|
|
557 |
# first step: get the video information
|
558 |
extract_frames_button.click(
|
559 |
fn=get_frames_from_video,
|
@@ -674,14 +682,4 @@ with gr.Blocks() as iface:
|
|
674 |
)
|
675 |
iface.queue(concurrency_count=1)
|
676 |
# iface.launch(debug=True, enable_queue=True, server_port=args.port, server_name="0.0.0.0")
|
677 |
-
iface.launch(debug=True, enable_queue=True)
|
678 |
-
|
679 |
-
@iface.route("/api/process_video")
|
680 |
-
|
681 |
-
def api_process_video(video_url):
|
682 |
-
|
683 |
-
video_path = download_video(video_url)
|
684 |
-
|
685 |
-
return get_frames_from_video(video_path)
|
686 |
-
|
687 |
-
iface.route("/api/process_video", api_process_video)
|
|
|
80 |
|
81 |
return video_path
|
82 |
|
83 |
+
def api_process_video(video_url):
|
84 |
+
|
85 |
+
video_path = download_video(video_url)
|
86 |
+
|
87 |
+
return get_frames_from_video(video_path)
|
88 |
|
89 |
# extract frames from upload video
|
90 |
def get_frames_from_video(video_input, video_state):
|
|
|
493 |
video_input = gr.Video(autosize=True)
|
494 |
with gr.Column():
|
495 |
video_info = gr.Textbox(label="Video Info")
|
496 |
+
video_path = gr.Textbox(label="Video Path")
|
497 |
resize_info = gr.Textbox(value="If you want to use the inpaint function, it is best to git clone the repo and use a machine with more VRAM locally. \
|
498 |
Alternatively, you can use the resize ratio slider to scale down the original image to around 360P resolution for faster processing.", label="Tips for running this demo.")
|
499 |
resize_ratio_slider = gr.Slider(minimum=0.02, maximum=1, step=0.02, value=0.6, label="Resize ratio", visible=True)
|
|
|
505 |
# extract frames
|
506 |
with gr.Column():
|
507 |
extract_frames_button = gr.Button(value="Get video info", interactive=True, variant="primary")
|
508 |
+
process_video = gr.Button(value="Process ideo", interactive=True, variant="primary")
|
509 |
# click points settins, negative or positive, mode continuous or single
|
510 |
with gr.Row():
|
511 |
with gr.Row():
|
|
|
558 |
outputs=[video_demo_operation],
|
559 |
# cache_examples=True,
|
560 |
)
|
561 |
+
process_video.click(
|
562 |
+
fn=api_process_video,
|
563 |
+
inputs=[video_input],outputs=[video_path], api_name="process_video"
|
564 |
+
)
|
565 |
# first step: get the video information
|
566 |
extract_frames_button.click(
|
567 |
fn=get_frames_from_video,
|
|
|
682 |
)
|
683 |
iface.queue(concurrency_count=1)
|
684 |
# iface.launch(debug=True, enable_queue=True, server_port=args.port, server_name="0.0.0.0")
|
685 |
+
iface.launch(debug=True, enable_queue=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appy.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from gradio_client import Client
|
2 |
+
|
3 |
+
client = Client("https://besarismaili-track-anything.hf.space/")
|
4 |
+
|
5 |
+
video_url = "https://github.com/besarismaili/track-anything/raw/main/video_001.mp4"
|
6 |
+
|
7 |
+
result = client.predict(video_url, api_name="process_video")
|
8 |
+
|
9 |
+
#print(client.config)
|
10 |
+
print(result)
|