Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import torch
|
|
2 |
import gradio as gr
|
3 |
from diffusers import StableVideoDiffusionPipeline
|
4 |
from diffusers.utils import load_image, export_to_video
|
5 |
-
import spaces
|
6 |
|
7 |
# Check if GPU is available
|
8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
@@ -13,7 +12,6 @@ pipeline = StableVideoDiffusionPipeline.from_pretrained(
|
|
13 |
)
|
14 |
pipeline.to(device)
|
15 |
|
16 |
-
@spaces.GPU(duration=120)
|
17 |
def generate_video(image_path, seed):
|
18 |
# Load and preprocess the image
|
19 |
image = load_image(image_path)
|
@@ -41,10 +39,10 @@ iface = gr.Interface(
|
|
41 |
outputs=gr.Video(label="Generated Video"),
|
42 |
title="Stable Video Diffusion",
|
43 |
description="Generate a video from an uploaded image using Stable Video Diffusion.",
|
44 |
-
examples
|
45 |
-
["image.jpeg",
|
46 |
],
|
47 |
-
gr.Examples(examples, [image_input, video_input])
|
48 |
)
|
|
|
49 |
# Launch the interface
|
50 |
-
iface.launch()
|
|
|
2 |
import gradio as gr
|
3 |
from diffusers import StableVideoDiffusionPipeline
|
4 |
from diffusers.utils import load_image, export_to_video
|
|
|
5 |
|
6 |
# Check if GPU is available
|
7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
12 |
)
|
13 |
pipeline.to(device)
|
14 |
|
|
|
15 |
def generate_video(image_path, seed):
|
16 |
# Load and preprocess the image
|
17 |
image = load_image(image_path)
|
|
|
39 |
outputs=gr.Video(label="Generated Video"),
|
40 |
title="Stable Video Diffusion",
|
41 |
description="Generate a video from an uploaded image using Stable Video Diffusion.",
|
42 |
+
examples=[
|
43 |
+
["image.jpeg", 42],
|
44 |
],
|
|
|
45 |
)
|
46 |
+
|
47 |
# Launch the interface
|
48 |
+
iface.launch()
|