Spaces:
Runtime error
Runtime error
Commit
·
9ee1fa9
1
Parent(s):
8778d00
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,20 @@ with gr.Blocks() as app:
|
|
46 |
results = model.predict(frame)
|
47 |
render = render_result(model=model, image=frame, result=results[0])
|
48 |
return render
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
|
52 |
with gr.Row():
|
@@ -65,6 +78,8 @@ with gr.Blocks() as app:
|
|
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 |
|
|
|
46 |
results = model.predict(frame)
|
47 |
render = render_result(model=model, image=frame, result=results[0])
|
48 |
return render
|
49 |
+
def fw_fn(cur,last):
|
50 |
+
if not int(cur)+1 > int(last):
|
51 |
+
next = int(cur)+1
|
52 |
+
else:
|
53 |
+
next = last
|
54 |
+
pass
|
55 |
+
return next
|
56 |
+
def bk_fn(cur):
|
57 |
+
if not int(cur)-1 < 0:
|
58 |
+
next = int(cur)-1
|
59 |
+
else:
|
60 |
+
next = 0
|
61 |
+
pass
|
62 |
+
return next
|
63 |
|
64 |
|
65 |
with gr.Row():
|
|
|
78 |
pl = gr.Button("Play")
|
79 |
fw = gr.Button(">")
|
80 |
det_win = gr.Image(source="webcam", streaming=True)
|
81 |
+
bk.click(bk_fn,[cur_frame],cur_frame)
|
82 |
+
fw.click(fw_fn,[cur_frame,total_frames],cur_frame)
|
83 |
load_button.click(load,youtube_url,[output_win,cur_frame,total_frames,fps_frames])
|
84 |
run_button.click(vid_play, [output_win,cur_frame], det_win)
|
85 |
|