jkcg commited on
Commit
a7c00cb
1 Parent(s): eccb444

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- from diffusers import DiffusionPipeline, StableDiffusionXLImg2ImgPipeline
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.float16,
12
  )
13
- pipe.to("cuda")
14
  pipe.load_lora_weights(prj_path, weight_name="pytorch_lora_weights.safetensors")
15
 
16
  def generate_image(prompt, seed):
17
- generator = torch.Generator("cuda").manual_seed(seed)
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