Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
from diffusers import DiffusionPipeline
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
|
@@ -8,13 +8,13 @@ prj_path = "jkcg/furniture-chair"
|
|
8 |
model = "stabilityai/stable-diffusion-xl-base-1.0"
|
9 |
pipe = DiffusionPipeline.from_pretrained(
|
10 |
model,
|
11 |
-
torch_dtype=torch.
|
12 |
)
|
13 |
-
pipe.to("
|
14 |
pipe.load_lora_weights(prj_path, weight_name="pytorch_lora_weights.safetensors")
|
15 |
|
16 |
def generate_image(prompt, seed):
|
17 |
-
generator = torch.Generator("
|
18 |
image = pipe(prompt=prompt, generator=generator).images[0]
|
19 |
return image
|
20 |
|
|
|
1 |
import gradio as gr
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
|
|
|
8 |
model = "stabilityai/stable-diffusion-xl-base-1.0"
|
9 |
pipe = DiffusionPipeline.from_pretrained(
|
10 |
model,
|
11 |
+
torch_dtype=torch.float32, # Use float32 for CPU
|
12 |
)
|
13 |
+
pipe.to("cpu") # Ensure the pipeline runs on CPU
|
14 |
pipe.load_lora_weights(prj_path, weight_name="pytorch_lora_weights.safetensors")
|
15 |
|
16 |
def generate_image(prompt, seed):
|
17 |
+
generator = torch.Generator("cpu").manual_seed(seed)
|
18 |
image = pipe(prompt=prompt, generator=generator).images[0]
|
19 |
return image
|
20 |
|