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