aiuser12345678 commited on
Commit
a1fd5ce
·
verified ·
1 Parent(s): 7897ab3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -5,18 +5,19 @@ import gradio as gr
5
  device = "cuda" if torch.cuda.is_available() else "cpu"
6
 
7
  pipe = StableDiffusionXLPipeline.from_pretrained(
8
- "stabilityai/sdxl-turbo",
9
  torch_dtype=torch.float16 if device == "cuda" else torch.float32,
 
10
  variant="fp16" if device == "cuda" else None
11
  ).to(device)
12
 
13
  def generate_image(prompt):
14
- image = pipe(prompt=prompt, guidance_scale=0.0, num_inference_steps=1).images[0]
15
  return image
16
 
17
  gr.Interface(
18
  fn=generate_image,
19
  inputs="text",
20
  outputs="image",
21
- title="Sanjay's Image Generator AI"
22
  ).launch()
 
5
  device = "cuda" if torch.cuda.is_available() else "cpu"
6
 
7
  pipe = StableDiffusionXLPipeline.from_pretrained(
8
+ "stabilityai/stable-diffusion-xl-base-1.0",
9
  torch_dtype=torch.float16 if device == "cuda" else torch.float32,
10
+ use_safetensors=True,
11
  variant="fp16" if device == "cuda" else None
12
  ).to(device)
13
 
14
  def generate_image(prompt):
15
+ image = pipe(prompt=prompt, num_inference_steps=30, guidance_scale=7.5).images[0]
16
  return image
17
 
18
  gr.Interface(
19
  fn=generate_image,
20
  inputs="text",
21
  outputs="image",
22
+ title="Sanjay's Perfect Image Generator"
23
  ).launch()