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