Spaces:
Runtime error
Runtime error
Commit
·
d31991f
1
Parent(s):
bbdb168
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
import gradio as gr
|
3 |
from PIL import Image
|
4 |
from diffusers import DiffusionPipeline
|
@@ -6,7 +5,7 @@ from diffusers import DiffusionPipeline
|
|
6 |
# Load model and scheduler
|
7 |
ldm = DiffusionPipeline.from_pretrained("CompVis/ldm-text2im-large-256")
|
8 |
|
9 |
-
def generate_image(prompt, negative_prompt, width, height):
|
10 |
# Run pipeline in inference (sample random noise and denoise)
|
11 |
images = ldm([prompt], num_inference_steps=50, eta=0.3, guidance_scale=6, negative_prompts=[negative_prompt]).images
|
12 |
# Resize image to desired width and height
|
@@ -25,7 +24,8 @@ iface = gr.Interface(
|
|
25 |
title="Image Generation",
|
26 |
description="Generate images based on prompts.",
|
27 |
article="For more information, visit the documentation: [link](https://docs.gradio.app/)",
|
|
|
28 |
)
|
29 |
|
30 |
# Launch the interface
|
31 |
-
iface.launch()
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
3 |
from diffusers import DiffusionPipeline
|
|
|
5 |
# Load model and scheduler
|
6 |
ldm = DiffusionPipeline.from_pretrained("CompVis/ldm-text2im-large-256")
|
7 |
|
8 |
+
def generate_image(prompt, negative_prompt="Low quality", width=512, height=512):
|
9 |
# Run pipeline in inference (sample random noise and denoise)
|
10 |
images = ldm([prompt], num_inference_steps=50, eta=0.3, guidance_scale=6, negative_prompts=[negative_prompt]).images
|
11 |
# Resize image to desired width and height
|
|
|
24 |
title="Image Generation",
|
25 |
description="Generate images based on prompts.",
|
26 |
article="For more information, visit the documentation: [link](https://docs.gradio.app/)",
|
27 |
+
examples=[["A painting of a squirrel eating a burger", "Low quality", 512, 512]]
|
28 |
)
|
29 |
|
30 |
# Launch the interface
|
31 |
+
iface.launch()
|