wanghuging commited on
Commit
dd2e743
·
1 Parent(s): 8f57828

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -44,7 +44,7 @@ if SAFETY_CHECKER == "True":
44
  t2i_pipe = AutoPipelineForText2Image.from_pretrained(
45
  "stabilityai/sdxl-turbo",
46
  torch_dtype=torch_dtype,
47
- variant="fp16" if torch_dtype == torch.float16 else "fp32",
48
  )
49
  else:
50
  i2i_pipe = AutoPipelineForImage2Image.from_pretrained(
@@ -57,7 +57,7 @@ else:
57
  "stabilityai/sdxl-turbo",
58
  safety_checker=None,
59
  torch_dtype=torch_dtype,
60
- variant="fp16" if torch_dtype == torch.float16 else "fp32",
61
  )
62
 
63
 
@@ -175,27 +175,27 @@ with gr.Blocks(css=css) as demo:
175
  step=1,
176
  )
177
 
178
- with gr.Accordion("Run with diffusers"):
179
- gr.Markdown(
180
- """## Running SDXL Turbo with `diffusers`
181
- ```bash
182
- pip install diffusers==0.23.1
183
- ```
184
- ```py
185
- from diffusers import DiffusionPipeline
186
- pipe = DiffusionPipeline.from_pretrained(
187
- "stabilityai/sdxl-turbo"
188
- ).to("cuda")
189
- results = pipe(
190
- prompt="A cinematic shot of a baby racoon wearing an intricate italian priest robe",
191
- num_inference_steps=1,
192
- guidance_scale=0.0,
193
- )
194
- imga = results.images[0]
195
- imga.save("image.png")
196
- ```
197
- """
198
- )
199
 
200
  inputs = [image_input, prompt, strength, steps, seed]
201
  generate_bt.click(fn=predict, inputs=inputs, outputs=image, show_progress=False)
 
44
  t2i_pipe = AutoPipelineForText2Image.from_pretrained(
45
  "stabilityai/sdxl-turbo",
46
  torch_dtype=torch_dtype,
47
+ variant="fp16" #if torch_dtype == torch.float16 else "fp32",
48
  )
49
  else:
50
  i2i_pipe = AutoPipelineForImage2Image.from_pretrained(
 
57
  "stabilityai/sdxl-turbo",
58
  safety_checker=None,
59
  torch_dtype=torch_dtype,
60
+ variant="fp16" #if torch_dtype == torch.float16 else "fp32",
61
  )
62
 
63
 
 
175
  step=1,
176
  )
177
 
178
+ # with gr.Accordion("Run with diffusers"):
179
+ # gr.Markdown(
180
+ # """## Running SDXL Turbo with `diffusers`
181
+ # ```bash
182
+ # pip install diffusers==0.23.1
183
+ # ```
184
+ # ```py
185
+ # from diffusers import DiffusionPipeline
186
+ # pipe = DiffusionPipeline.from_pretrained(
187
+ # "stabilityai/sdxl-turbo"
188
+ # ).to("cuda")
189
+ # results = pipe(
190
+ # prompt="A cinematic shot of a baby racoon wearing an intricate italian priest robe",
191
+ # num_inference_steps=1,
192
+ # guidance_scale=0.0,
193
+ # )
194
+ # imga = results.images[0]
195
+ # imga.save("image.png")
196
+ # ```
197
+ # """
198
+ # )
199
 
200
  inputs = [image_input, prompt, strength, steps, seed]
201
  generate_bt.click(fn=predict, inputs=inputs, outputs=image, show_progress=False)