Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffusers import DiffusionPipeline
|
| 2 |
+
import torch
|
| 3 |
+
|
| 4 |
+
device = "cuda" if torch.cuda.is _available() else "cpu"
|
| 5 |
+
|
| 6 |
+
pipeline=DiffusionPipeline.from_pretrained("stabilityai/stable-video-diffusion-img2vid-xt")
|
| 7 |
+
pipeline = pipeline.to(devices)
|
| 8 |
+
|
| 9 |
+
prompt = "A beautiful sunset over the ocean"
|
| 10 |
+
video = pipeline(prompt,num_interface_steps=50).videos
|
| 11 |
+
|
| 12 |
+
video path = "generated_video.mp4"with open(video_path, "wb") as f:
|
| 13 |
+
f.write(video[0])
|
| 14 |
+
|
| 15 |
+
print(f"video generated and saved as {video_path}")
|