Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from diffusers import StableVideoDiffusionPipeline, EulerDiscreteScheduler
|
| 3 |
import torch
|
|
|
|
| 4 |
|
| 5 |
# Load the Stable Video Diffusion model
|
| 6 |
model_id = "stabilityai/stable-video-diffusion-img2vid-xt"
|
|
@@ -8,6 +9,7 @@ pipe = StableVideoDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.
|
|
| 8 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 9 |
pipe.to("cuda")
|
| 10 |
|
|
|
|
| 11 |
def generate_video(image, prompt, num_frames=25, resolution=(576, 1024)):
|
| 12 |
# Generate the video
|
| 13 |
video_frames = pipe(prompt, image=image, num_frames=num_frames, height=resolution[0], width=resolution[1]).frames
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from diffusers import StableVideoDiffusionPipeline, EulerDiscreteScheduler
|
| 3 |
import torch
|
| 4 |
+
import GPU
|
| 5 |
|
| 6 |
# Load the Stable Video Diffusion model
|
| 7 |
model_id = "stabilityai/stable-video-diffusion-img2vid-xt"
|
|
|
|
| 9 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 10 |
pipe.to("cuda")
|
| 11 |
|
| 12 |
+
@spaces.GPU
|
| 13 |
def generate_video(image, prompt, num_frames=25, resolution=(576, 1024)):
|
| 14 |
# Generate the video
|
| 15 |
video_frames = pipe(prompt, image=image, num_frames=num_frames, height=resolution[0], width=resolution[1]).frames
|