Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
@@ -22,7 +22,7 @@ def sample_frames_from_video_file(
|
|
22 |
# sample frames
|
23 |
start_idx = 0
|
24 |
end_idx = num_frames * frame_sampling_rate - 1
|
25 |
-
indices = np.linspace(start_idx, end_idx, num=num_frames, dtype=
|
26 |
frames = videoreader.get_batch(indices).asnumpy()
|
27 |
|
28 |
return frames
|
@@ -35,7 +35,7 @@ def get_num_total_frames(file_path: str):
|
|
35 |
|
36 |
|
37 |
def convert_frames_to_gif(frames, save_path: str = "frames.gif"):
|
38 |
-
converted_frames = frames.astype(
|
39 |
Path(save_path).parent.mkdir(parents=True, exist_ok=True)
|
40 |
imageio.mimsave(save_path, converted_frames, duration=125) # 8fps
|
41 |
return save_path
|
|
|
22 |
# sample frames
|
23 |
start_idx = 0
|
24 |
end_idx = num_frames * frame_sampling_rate - 1
|
25 |
+
indices = np.linspace(start_idx, end_idx, num=num_frames, dtype=np.int64)
|
26 |
frames = videoreader.get_batch(indices).asnumpy()
|
27 |
|
28 |
return frames
|
|
|
35 |
|
36 |
|
37 |
def convert_frames_to_gif(frames, save_path: str = "frames.gif"):
|
38 |
+
converted_frames = frames.astype(np.uint8)
|
39 |
Path(save_path).parent.mkdir(parents=True, exist_ok=True)
|
40 |
imageio.mimsave(save_path, converted_frames, duration=125) # 8fps
|
41 |
return save_path
|