Spaces:
Runtime error
Runtime error
Future-Tense
commited on
Commit
·
eb7cee4
1
Parent(s):
306dd29
Update app.py
Browse files
app.py
CHANGED
@@ -50,9 +50,9 @@ def bk_fn(cur):
|
|
50 |
next = 0
|
51 |
return next
|
52 |
def tog_on():
|
53 |
-
return 1
|
54 |
def tog_off():
|
55 |
-
return 0
|
56 |
|
57 |
def pl_fn(cap,cur,last,fps,pl_tog):
|
58 |
player.set(cv2.CAP_PROP_POS_FRAMES, cur)
|
@@ -68,6 +68,8 @@ def pl_fn(cap,cur,last,fps,pl_tog):
|
|
68 |
|
69 |
with gr.Blocks() as app:
|
70 |
gr.Markdown("""<center><h1>Slow Video Object Detection</h1><h4>Gradio and ultralyticsplus/yolov8s</h4><h4>Probably faster on GPU 🤷♂️</h4></center>""")
|
|
|
|
|
71 |
with gr.Row():
|
72 |
with gr.Column():
|
73 |
youtube_url = gr.Textbox(label="YouTube URL",value=f"{URL}")
|
@@ -88,8 +90,8 @@ with gr.Blocks() as app:
|
|
88 |
with gr.Row():
|
89 |
pl_tog=gr.Number(visible=False)
|
90 |
ins_cnt=gr.Number(visible=False)
|
91 |
-
pl.click(tog_on,None,pl_tog,show_progress=False)
|
92 |
-
st.click(tog_off,None,pl_tog,show_progress=False)
|
93 |
pl_tog.change(pl_fn,[output_win,cur_frame,total_frames,fps_frames,pl_tog],[det_win,cur_frame],show_progress=False)
|
94 |
cur_frame.change(pl_fn,[output_win,cur_frame,total_frames,fps_frames,pl_tog],[det_win,cur_frame],show_progress=False)
|
95 |
bk.click(bk_fn,[cur_frame],cur_frame,show_progress=False)
|
|
|
50 |
next = 0
|
51 |
return next
|
52 |
def tog_on():
|
53 |
+
return 1,gr.Markdown.update("""<right><h7>Playing 😴</h7></right>""")
|
54 |
def tog_off():
|
55 |
+
return 0,gr.Markdown.update("""<right><h7>Stopped 💀</h7></right>""")
|
56 |
|
57 |
def pl_fn(cap,cur,last,fps,pl_tog):
|
58 |
player.set(cv2.CAP_PROP_POS_FRAMES, cur)
|
|
|
68 |
|
69 |
with gr.Blocks() as app:
|
70 |
gr.Markdown("""<center><h1>Slow Video Object Detection</h1><h4>Gradio and ultralyticsplus/yolov8s</h4><h4>Probably faster on GPU 🤷♂️</h4></center>""")
|
71 |
+
play_state = gr.Markdown("""<right><h7>Stopped</h7></right>""")
|
72 |
+
|
73 |
with gr.Row():
|
74 |
with gr.Column():
|
75 |
youtube_url = gr.Textbox(label="YouTube URL",value=f"{URL}")
|
|
|
90 |
with gr.Row():
|
91 |
pl_tog=gr.Number(visible=False)
|
92 |
ins_cnt=gr.Number(visible=False)
|
93 |
+
pl.click(tog_on,None,[pl_tog,play_state],show_progress=False)
|
94 |
+
st.click(tog_off,None,[pl_tog,play_state],show_progress=False)
|
95 |
pl_tog.change(pl_fn,[output_win,cur_frame,total_frames,fps_frames,pl_tog],[det_win,cur_frame],show_progress=False)
|
96 |
cur_frame.change(pl_fn,[output_win,cur_frame,total_frames,fps_frames,pl_tog],[det_win,cur_frame],show_progress=False)
|
97 |
bk.click(bk_fn,[cur_frame],cur_frame,show_progress=False)
|