Spaces:
Sleeping
Sleeping
Tidy
Browse files
app.py
CHANGED
@@ -25,6 +25,7 @@ def fn(video: gr.Video, actions: list[int]):
|
|
25 |
print('Process video.')
|
26 |
do_detect = 0 in actions
|
27 |
do_classify = 1 in actions
|
|
|
28 |
if not do_detect and not do_classify:
|
29 |
yield None, video
|
30 |
return
|
@@ -60,7 +61,11 @@ def fn(video: gr.Video, actions: list[int]):
|
|
60 |
with tempfile.NamedTemporaryFile(suffix='.jpeg') as f:
|
61 |
f.write(image_encoded)
|
62 |
yield f.name, None
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
processed_clip = ImageSequenceClip(processed_frames, clip.fps)
|
65 |
processed_clip.audio = clip.audio
|
66 |
processed_clip.write_videofile(output, fps=clip.fps, audio_codec='aac', logger=None)
|
|
|
25 |
print('Process video.')
|
26 |
do_detect = 0 in actions
|
27 |
do_classify = 1 in actions
|
28 |
+
toggle = True
|
29 |
if not do_detect and not do_classify:
|
30 |
yield None, video
|
31 |
return
|
|
|
61 |
with tempfile.NamedTemporaryFile(suffix='.jpeg') as f:
|
62 |
f.write(image_encoded)
|
63 |
yield f.name, None
|
64 |
+
if toggle:
|
65 |
+
time.sleep(2)
|
66 |
+
toggle = False
|
67 |
+
if i % config.classify_action_frame_step != 0 and i % config.detect_object_frame_step != 0:
|
68 |
+
time.sleep(0.3)
|
69 |
processed_clip = ImageSequenceClip(processed_frames, clip.fps)
|
70 |
processed_clip.audio = clip.audio
|
71 |
processed_clip.write_videofile(output, fps=clip.fps, audio_codec='aac', logger=None)
|