Spaces:
Runtime error
Runtime error
Future-Tense
commited on
Commit
·
7c932a9
1
Parent(s):
e1f13a6
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,8 @@ with gr.Blocks() as app:
|
|
40 |
assert player.isOpened() # Make sure that their is a stream.
|
41 |
player.set(cv2.CAP_PROP_POS_FRAMES, int(frame_num))
|
42 |
|
43 |
-
ret,
|
|
|
44 |
results = model.predict(frame)
|
45 |
render = render_result(model=model, image=frame, result=results[0])
|
46 |
return render
|
@@ -57,8 +58,7 @@ with gr.Blocks() as app:
|
|
57 |
cur_frame = gr.Number()
|
58 |
total_frames = gr.Number(interactive=False)
|
59 |
run_button = gr.Button()
|
60 |
-
|
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(vid_play2, [output_win,cur_frame], det_win)
|
64 |
|
|
|
40 |
assert player.isOpened() # Make sure that their is a stream.
|
41 |
player.set(cv2.CAP_PROP_POS_FRAMES, int(frame_num))
|
42 |
|
43 |
+
ret, frame_bgr = player.read(int(frame_num))
|
44 |
+
frame = cv2.cvtColor(frame_bgr, cv2.COLOR_BGR2RGB)
|
45 |
results = model.predict(frame)
|
46 |
render = render_result(model=model, image=frame, result=results[0])
|
47 |
return render
|
|
|
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(vid_play2, [output_win,cur_frame], det_win)
|
64 |
|