Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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/
|
| 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,
|
| 15 |
return image
|
| 16 |
|
| 17 |
gr.Interface(
|
| 18 |
fn=generate_image,
|
| 19 |
inputs="text",
|
| 20 |
outputs="image",
|
| 21 |
-
title="Sanjay's Image Generator
|
| 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()
|