Spaces:
Runtime error
Runtime error
Commit
·
ea778b2
1
Parent(s):
265b26d
Update app.py
Browse files
app.py
CHANGED
@@ -59,6 +59,11 @@ def bk_fn(cur):
|
|
59 |
if next < 0:
|
60 |
next = 0
|
61 |
return next
|
|
|
|
|
|
|
|
|
|
|
62 |
def pl_fn(cap,cur,last,fps,pl_tog):
|
63 |
#player = cv2.VideoCapture(cap)
|
64 |
#assert player.isOpened() # Make sure that their is a stream.
|
@@ -90,11 +95,15 @@ with gr.Blocks() as app:
|
|
90 |
with gr.Row():
|
91 |
bk = gr.Button("<")
|
92 |
pl = gr.Button("Play")
|
|
|
93 |
fw = gr.Button(">")
|
94 |
det_win = gr.Image(source="webcam", streaming=True)
|
95 |
with gr.Row():
|
96 |
pl_tog=gr.Number()
|
97 |
-
pl.click(
|
|
|
|
|
|
|
98 |
bk.click(bk_fn,[cur_frame],cur_frame)
|
99 |
fw.click(fw_fn,[cur_frame,total_frames],cur_frame)
|
100 |
load_button.click(load,youtube_url,[output_win,cur_frame,total_frames,fps_frames])
|
|
|
59 |
if next < 0:
|
60 |
next = 0
|
61 |
return next
|
62 |
+
def tog_on():
|
63 |
+
return 1
|
64 |
+
def tog_off():
|
65 |
+
return 0
|
66 |
+
|
67 |
def pl_fn(cap,cur,last,fps,pl_tog):
|
68 |
#player = cv2.VideoCapture(cap)
|
69 |
#assert player.isOpened() # Make sure that their is a stream.
|
|
|
95 |
with gr.Row():
|
96 |
bk = gr.Button("<")
|
97 |
pl = gr.Button("Play")
|
98 |
+
st = gr.Button("Stop")
|
99 |
fw = gr.Button(">")
|
100 |
det_win = gr.Image(source="webcam", streaming=True)
|
101 |
with gr.Row():
|
102 |
pl_tog=gr.Number()
|
103 |
+
pl.click(tog_on,None,pl_tog)
|
104 |
+
st.click(tog_off,None,pl_tog)
|
105 |
+
pl_tog.change(pl_fn,[output_win,cur_frame,total_frames,fps_frames,pl_tog],[det_win,cur_frame],show_progress=False)
|
106 |
+
cur_frame.change(pl_fn,[output_win,cur_frame,total_frames,fps_frames,pl_tog],[det_win,cur_frame],show_progress=False)
|
107 |
bk.click(bk_fn,[cur_frame],cur_frame)
|
108 |
fw.click(fw_fn,[cur_frame,total_frames],cur_frame)
|
109 |
load_button.click(load,youtube_url,[output_win,cur_frame,total_frames,fps_frames])
|