Spaces:
Runtime error
Runtime error
Commit
·
8778d00
1
Parent(s):
7c932a9
Update app.py
Browse files
app.py
CHANGED
@@ -31,11 +31,12 @@ with gr.Blocks() as app:
|
|
31 |
process = cv2.VideoCapture(vid_cap)
|
32 |
frame_num = int(process.get(cv2.CAP_PROP_POS_FRAMES))
|
33 |
frame_count = int(process.get(cv2.CAP_PROP_FRAME_COUNT))
|
|
|
34 |
process.release()
|
35 |
|
36 |
-
return vid_cap,frame_num,frame_count
|
37 |
|
38 |
-
def
|
39 |
player = cv2.VideoCapture(cap)
|
40 |
assert player.isOpened() # Make sure that their is a stream.
|
41 |
player.set(cv2.CAP_PROP_POS_FRAMES, int(frame_num))
|
@@ -55,11 +56,16 @@ with gr.Blocks() as app:
|
|
55 |
output_win = gr.Video()
|
56 |
with gr.Column():
|
57 |
with gr.Row():
|
58 |
-
cur_frame = gr.Number()
|
|
|
59 |
total_frames = gr.Number(interactive=False)
|
60 |
run_button = gr.Button()
|
|
|
|
|
|
|
|
|
61 |
det_win = gr.Image(source="webcam", streaming=True)
|
62 |
-
load_button.click(load,youtube_url,[output_win,cur_frame,total_frames])
|
63 |
-
run_button.click(
|
64 |
|
65 |
app.launch(enable_queue=False)
|
|
|
31 |
process = cv2.VideoCapture(vid_cap)
|
32 |
frame_num = int(process.get(cv2.CAP_PROP_POS_FRAMES))
|
33 |
frame_count = int(process.get(cv2.CAP_PROP_FRAME_COUNT))
|
34 |
+
frame_fps = (process.get(cv2.CAP_PROP_FPS))
|
35 |
process.release()
|
36 |
|
37 |
+
return vid_cap,frame_num,frame_count,frame_fps
|
38 |
|
39 |
+
def vid_play(cap,frame_num):
|
40 |
player = cv2.VideoCapture(cap)
|
41 |
assert player.isOpened() # Make sure that their is a stream.
|
42 |
player.set(cv2.CAP_PROP_POS_FRAMES, int(frame_num))
|
|
|
56 |
output_win = gr.Video()
|
57 |
with gr.Column():
|
58 |
with gr.Row():
|
59 |
+
cur_frame = gr.Number()
|
60 |
+
fps_frames = gr.Number()
|
61 |
total_frames = gr.Number(interactive=False)
|
62 |
run_button = gr.Button()
|
63 |
+
with gr.Row():
|
64 |
+
bk = gr.Button("<")
|
65 |
+
pl = gr.Button("Play")
|
66 |
+
fw = gr.Button(">")
|
67 |
det_win = gr.Image(source="webcam", streaming=True)
|
68 |
+
load_button.click(load,youtube_url,[output_win,cur_frame,total_frames,fps_frames])
|
69 |
+
run_button.click(vid_play, [output_win,cur_frame], det_win)
|
70 |
|
71 |
app.launch(enable_queue=False)
|