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(device) 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}")