Spaces:
Paused
Paused
Commit
·
9f296e7
1
Parent(s):
e95fabc
Fix video export format and add proper dependencies
Browse files- Handle different pipeline output formats (frames attribute vs list)
- Add imageio and imageio-ffmpeg for proper video export
- Fix 'list' object has no attribute 'shape' error
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- app.py +11 -3
- requirements.txt +3 -1
app.py
CHANGED
|
@@ -60,7 +60,7 @@ def generate_interpolation(
|
|
| 60 |
# Generate video
|
| 61 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 62 |
|
| 63 |
-
|
| 64 |
prompt=prompt,
|
| 65 |
first_image=first_image,
|
| 66 |
last_image=last_image,
|
|
@@ -69,14 +69,22 @@ def generate_interpolation(
|
|
| 69 |
num_frames=num_frames,
|
| 70 |
guidance_scale=guidance_scale,
|
| 71 |
generator=generator,
|
| 72 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
# Export to temporary file
|
| 75 |
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4")
|
| 76 |
output_path = temp_file.name
|
| 77 |
temp_file.close()
|
| 78 |
|
| 79 |
-
export_to_video(
|
| 80 |
|
| 81 |
status = f"✓ Video generated successfully! ({num_frames} frames at {fps} fps)"
|
| 82 |
print(status)
|
|
|
|
| 60 |
# Generate video
|
| 61 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 62 |
|
| 63 |
+
output = pipe(
|
| 64 |
prompt=prompt,
|
| 65 |
first_image=first_image,
|
| 66 |
last_image=last_image,
|
|
|
|
| 69 |
num_frames=num_frames,
|
| 70 |
guidance_scale=guidance_scale,
|
| 71 |
generator=generator,
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
# Extract video frames - handle different output formats
|
| 75 |
+
if hasattr(output, 'frames'):
|
| 76 |
+
video_frames = output.frames[0]
|
| 77 |
+
elif isinstance(output, (list, tuple)):
|
| 78 |
+
video_frames = output[0]
|
| 79 |
+
else:
|
| 80 |
+
video_frames = output
|
| 81 |
|
| 82 |
# Export to temporary file
|
| 83 |
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4")
|
| 84 |
output_path = temp_file.name
|
| 85 |
temp_file.close()
|
| 86 |
|
| 87 |
+
export_to_video(video_frames, output_path, fps=fps)
|
| 88 |
|
| 89 |
status = f"✓ Video generated successfully! ({num_frames} frames at {fps} fps)"
|
| 90 |
print(status)
|
requirements.txt
CHANGED
|
@@ -6,4 +6,6 @@ torchvision
|
|
| 6 |
Pillow
|
| 7 |
spaces
|
| 8 |
sentencepiece
|
| 9 |
-
opencv-python-headless
|
|
|
|
|
|
|
|
|
| 6 |
Pillow
|
| 7 |
spaces
|
| 8 |
sentencepiece
|
| 9 |
+
opencv-python-headless
|
| 10 |
+
imageio
|
| 11 |
+
imageio-ffmpeg
|