Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -19,10 +19,16 @@ def generate_image(prompt):
|
|
| 19 |
image = response.content
|
| 20 |
return image
|
| 21 |
else:
|
|
|
|
| 22 |
return "Error: " + response.text
|
| 23 |
|
| 24 |
# Create the Gradio interface
|
| 25 |
-
iface = gr.Interface(fn=generate_image,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Launch the Gradio app
|
| 28 |
iface.launch()
|
|
|
|
| 19 |
image = response.content
|
| 20 |
return image
|
| 21 |
else:
|
| 22 |
+
print(response.text)
|
| 23 |
return "Error: " + response.text
|
| 24 |
|
| 25 |
# Create the Gradio interface
|
| 26 |
+
iface = gr.Interface(fn=generate_image,
|
| 27 |
+
inputs=gr.Textbox(label="Enter your prompt", placeholder="Type your prompt here..."),
|
| 28 |
+
outputs="image",
|
| 29 |
+
live=False, # live=False ensures the image is generated only after clicking the button
|
| 30 |
+
title="Stable Diffusion Image Generator",
|
| 31 |
+
description="Generate images using the Stable Diffusion XL model from Hugging Face API.")
|
| 32 |
|
| 33 |
# Launch the Gradio app
|
| 34 |
iface.launch()
|