Spaces:
Running
on
Zero
Running
on
Zero
Staticaliza
commited on
Commit
•
ef4d60d
1
Parent(s):
1b6a68d
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def encode_video(video_path):
|
|
38 |
vr = VideoReader(video_path, ctx=cpu(0))
|
39 |
sample_fps = round(vr.get_avg_fps() / 1)
|
40 |
frame_idx = [i for i in range(0, len(vr), sample_fps)]
|
41 |
-
if len(frame_idx) >
|
42 |
frame_idx = uniform_sample(frame_idx, MAX_FRAMES)
|
43 |
frames = vr.get_batch(frame_idx).asnumpy()
|
44 |
frames = [Image.fromarray(v.astype('uint8')) for v in frames]
|
|
|
38 |
vr = VideoReader(video_path, ctx=cpu(0))
|
39 |
sample_fps = round(vr.get_avg_fps() / 1)
|
40 |
frame_idx = [i for i in range(0, len(vr), sample_fps)]
|
41 |
+
if len(frame_idx) > MAX_FRAMES:
|
42 |
frame_idx = uniform_sample(frame_idx, MAX_FRAMES)
|
43 |
frames = vr.get_batch(frame_idx).asnumpy()
|
44 |
frames = [Image.fromarray(v.astype('uint8')) for v in frames]
|