Spaces:
Running on Zero
Running on Zero
[Admin maintenance] Support new ZeroGPU hardware
#5
by multimodalart HF Staff - opened
- app.py +7 -3
- requirements.txt +0 -2
app.py
CHANGED
|
@@ -58,9 +58,13 @@ def save_video(video_array, video_save_path, fps: int = 16):
|
|
| 58 |
video = (video + 1.0) / 2.0
|
| 59 |
video = (video * 255).to(torch.uint8).permute(0, 2, 3, 1)
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
example_txt = [
|
| 66 |
"An astronaut riding a horse.",
|
|
|
|
| 58 |
video = (video + 1.0) / 2.0
|
| 59 |
video = (video * 255).to(torch.uint8).permute(0, 2, 3, 1)
|
| 60 |
|
| 61 |
+
frames = video.numpy()
|
| 62 |
+
writer = imageio.get_writer(video_save_path, fps=fps, codec="libx264", quality=8)
|
| 63 |
+
try:
|
| 64 |
+
for frame in frames:
|
| 65 |
+
writer.append_data(frame)
|
| 66 |
+
finally:
|
| 67 |
+
writer.close()
|
| 68 |
|
| 69 |
example_txt = [
|
| 70 |
"An astronaut riding a horse.",
|
requirements.txt
CHANGED
|
@@ -1,6 +1,4 @@
|
|
| 1 |
numpy==1.26.4
|
| 2 |
-
torch==2.2.2
|
| 3 |
-
torchvision==0.17.2
|
| 4 |
diffusers==0.30.0
|
| 5 |
transformers==4.44.0
|
| 6 |
accelerate==0.34.1
|
|
|
|
| 1 |
numpy==1.26.4
|
|
|
|
|
|
|
| 2 |
diffusers==0.30.0
|
| 3 |
transformers==4.44.0
|
| 4 |
accelerate==0.34.1
|