Spaces:
Runtime error
Runtime error
heheyas
commited on
Commit
•
608f7da
1
Parent(s):
9ab6bb1
opencv instead of imageio
Browse files
app.py
CHANGED
@@ -27,6 +27,7 @@ from pathlib import Path
|
|
27 |
import spaces
|
28 |
from huggingface_hub import hf_hub_download
|
29 |
import imageio
|
|
|
30 |
|
31 |
|
32 |
@spaces.GPU
|
@@ -136,7 +137,16 @@ def do_sample(
|
|
136 |
.astype(np.uint8)
|
137 |
)
|
138 |
# write_video(video_path, frames, fps=6)
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
return video_path
|
142 |
|
|
|
27 |
import spaces
|
28 |
from huggingface_hub import hf_hub_download
|
29 |
import imageio
|
30 |
+
import cv2
|
31 |
|
32 |
|
33 |
@spaces.GPU
|
|
|
137 |
.astype(np.uint8)
|
138 |
)
|
139 |
# write_video(video_path, frames, fps=6)
|
140 |
+
writer = cv2.VideoWriter(
|
141 |
+
video_path,
|
142 |
+
cv2.VideoWriter_fourcc(*"MP4V"),
|
143 |
+
6,
|
144 |
+
(frames.shape[-1], frames.shape[-2]),
|
145 |
+
)
|
146 |
+
for fr in frames:
|
147 |
+
writer.write(cv2.cvtColor(fr, cv2.COLOR_RGB2BGR))
|
148 |
+
writer.release()
|
149 |
+
# imageio.mimwrite(video_path, frames, fps=6)
|
150 |
|
151 |
return video_path
|
152 |
|