Runwaymlfaiz / Video_generator.py
Faizbulbul's picture
Create Video_generator.py
5d9832a verified
raw
history blame
433 Bytes
from diffusers import StableVideoDiffusionPipeline
import torch
# Model Load
pipe = StableVideoDiffusionPipeline.from_pretrained(
"stabilityai/stable-video-diffusion-img2vid",
torch_dtype=torch.float16
).to("cuda")
def generate_video(prompt):
video = pipe(prompt, num_inference_steps=25).frames
video_path = "generated_video.mp4"
video[0].save(video_path) # Save the first generated video
return video_path