Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,15 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from diffusers import StableVideoDiffusionPipeline
|
3 |
import torch
|
4 |
-
|
|
|
5 |
os.system("pip install -r requirements.txt")
|
6 |
-
iface.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", 7860)))
|
7 |
|
8 |
# Model Load
|
9 |
model_id = "stabilityai/stable-video-diffusion-img2vid"
|
10 |
-
pipe = StableVideoDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
|
|
|
11 |
|
12 |
# Function to Generate Video
|
13 |
def generate_video(prompt):
|
@@ -18,5 +20,8 @@ def generate_video(prompt):
|
|
18 |
|
19 |
# Gradio Interface
|
20 |
iface = gr.Interface(fn=generate_video, inputs="text", outputs="video")
|
21 |
-
|
|
|
|
|
|
|
22 |
|
|
|
1 |
+
import os
|
2 |
import gradio as gr
|
3 |
from diffusers import StableVideoDiffusionPipeline
|
4 |
import torch
|
5 |
+
|
6 |
+
# Ensure dependencies are installed
|
7 |
os.system("pip install -r requirements.txt")
|
|
|
8 |
|
9 |
# Model Load
|
10 |
model_id = "stabilityai/stable-video-diffusion-img2vid"
|
11 |
+
pipe = StableVideoDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
|
12 |
+
pipe.to("cpu") # Ensure model runs on CPU
|
13 |
|
14 |
# Function to Generate Video
|
15 |
def generate_video(prompt):
|
|
|
20 |
|
21 |
# Gradio Interface
|
22 |
iface = gr.Interface(fn=generate_video, inputs="text", outputs="video")
|
23 |
+
|
24 |
+
# Launch Gradio Server on Hugging Face Space
|
25 |
+
iface.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", 7860)))
|
26 |
+
|
27 |
|