text-video / app.py
shaaravpawar's picture
Create app.py
27435c3 verified
raw
history blame
480 Bytes
from diffusers import DiffusionPipeline
import torch
device = "cuda" if torch.cuda.is _available() else "cpu"
pipeline=DiffusionPipeline.from_pretrained("stabilityai/stable-video-diffusion-img2vid-xt")
pipeline = pipeline.to(devices)
prompt = "A beautiful sunset over the ocean"
video = pipeline(prompt,num_interface_steps=50).videos
video path = "generated_video.mp4"with open(video_path, "wb") as f:
f.write(video[0])
print(f"video generated and saved as {video_path}")