Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,8 @@ def generate_image(prompt, num_inference_steps=50, guidance_scale=7):
|
|
31 |
|
32 |
return results.images[0]
|
33 |
|
|
|
|
|
34 |
# Gradio Interface
|
35 |
description = """
|
36 |
This demo utilizes the playgroundai/playground-v2.5-1024px-aesthetic by Playground, which is a text-to-image generative model capable of producing high-quality images.
|
@@ -38,19 +40,28 @@ As a community effort, this demo was put together by AngryPenguin. Link to model
|
|
38 |
"""
|
39 |
|
40 |
with gr.Blocks() as demo:
|
|
|
41 |
gr.Markdown("## Playground-V2.5 Demo")
|
|
|
|
|
42 |
with gr.Row():
|
43 |
prompt = gr.Textbox(label='Enter your image prompt')
|
|
|
|
|
|
|
44 |
num_inference_steps = gr.Slider(minimum=1, maximum=75, step=1, label='Number of Inference Steps', value=50)
|
45 |
guidance_scale = gr.Slider(minimum=1, maximum=10, step=0.1, label='Guidance Scale', value=5)
|
46 |
-
|
|
|
|
|
|
|
|
|
47 |
img = gr.Image(label='Generated Image')
|
48 |
|
49 |
submit.click(
|
50 |
-
fn=generate_image,
|
51 |
inputs=[prompt, num_inference_steps, guidance_scale],
|
52 |
outputs=img,
|
53 |
)
|
54 |
|
55 |
-
|
56 |
demo.queue().launch()
|
|
|
31 |
|
32 |
return results.images[0]
|
33 |
|
34 |
+
import gradio as gr
|
35 |
+
|
36 |
# Gradio Interface
|
37 |
description = """
|
38 |
This demo utilizes the playgroundai/playground-v2.5-1024px-aesthetic by Playground, which is a text-to-image generative model capable of producing high-quality images.
|
|
|
40 |
"""
|
41 |
|
42 |
with gr.Blocks() as demo:
|
43 |
+
gr.Markdown(description) # Display the description at the top of the interface
|
44 |
gr.Markdown("## Playground-V2.5 Demo")
|
45 |
+
|
46 |
+
# Prompt on its own row
|
47 |
with gr.Row():
|
48 |
prompt = gr.Textbox(label='Enter your image prompt')
|
49 |
+
|
50 |
+
# Sliders for inference steps and guidance scale on another row
|
51 |
+
with gr.Row():
|
52 |
num_inference_steps = gr.Slider(minimum=1, maximum=75, step=1, label='Number of Inference Steps', value=50)
|
53 |
guidance_scale = gr.Slider(minimum=1, maximum=10, step=0.1, label='Guidance Scale', value=5)
|
54 |
+
|
55 |
+
# Submit button
|
56 |
+
submit = gr.Button('Generate Image')
|
57 |
+
|
58 |
+
# Image output at the bottom
|
59 |
img = gr.Image(label='Generated Image')
|
60 |
|
61 |
submit.click(
|
62 |
+
fn=generate_image, # This function needs to be defined to generate the image based on the inputs
|
63 |
inputs=[prompt, num_inference_steps, guidance_scale],
|
64 |
outputs=img,
|
65 |
)
|
66 |
|
|
|
67 |
demo.queue().launch()
|