sergon19 commited on
Commit
3f1dec5
β€’
1 Parent(s): 8c26a19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -5,19 +5,20 @@ import gradio as gr
5
  import torch
6
  from diffusers import DiffusionPipeline, AutoencoderKL
7
 
8
- vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float32)
9
  pipe = DiffusionPipeline.from_pretrained(
10
  "stabilityai/stable-diffusion-xl-base-1.0",
11
  vae=vae,
12
- torch_dtype=torch.float32,
 
13
  use_safetensors=True
14
  )
15
  pipe.load_lora_weights("sergon19/green_bg_LoRa10")
16
- _ = pipe.to("cpu")
17
 
18
  def generate_image(prompt):
19
  image = pipe(prompt=prompt, num_inference_steps=25).images[0]
20
  return image
21
 
22
  iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
23
- iface.launch()
 
5
  import torch
6
  from diffusers import DiffusionPipeline, AutoencoderKL
7
 
8
+ vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
9
  pipe = DiffusionPipeline.from_pretrained(
10
  "stabilityai/stable-diffusion-xl-base-1.0",
11
  vae=vae,
12
+ torch_dtype=torch.float16,
13
+ variant="fp16",
14
  use_safetensors=True
15
  )
16
  pipe.load_lora_weights("sergon19/green_bg_LoRa10")
17
+ _ = pipe.to("cuda")
18
 
19
  def generate_image(prompt):
20
  image = pipe(prompt=prompt, num_inference_steps=25).images[0]
21
  return image
22
 
23
  iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
24
+ iface.launch()