Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,16 @@ from diffusers import StableDiffusionPipeline
|
|
2 |
from PIL import Image
|
3 |
import imageio
|
4 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Load Stable Diffusion model
|
7 |
-
model_id = "runwayml/stable-diffusion-v1-5" #
|
8 |
-
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=
|
9 |
-
pipe.to(
|
10 |
|
11 |
def generate_frames(prompt, num_frames=5, style="realistic"):
|
12 |
"""
|
|
|
2 |
from PIL import Image
|
3 |
import imageio
|
4 |
import gradio as gr
|
5 |
+
import torch
|
6 |
+
|
7 |
+
# Dynamic device and data type allocation
|
8 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
+
dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
10 |
|
11 |
# Load Stable Diffusion model
|
12 |
+
model_id = "runwayml/stable-diffusion-v1-5" # Replace with your desired model ID
|
13 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=dtype, safety_checker=None)
|
14 |
+
pipe.to(device)
|
15 |
|
16 |
def generate_frames(prompt, num_frames=5, style="realistic"):
|
17 |
"""
|