Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -172,44 +172,41 @@ label{
|
|
172 |
"""
|
173 |
|
174 |
|
175 |
-
with gr.Blocks(css=css) as demo:
|
176 |
-
gr.Markdown(
|
177 |
-
"""
|
178 |
-
# Xylaria Iris Image Generator
|
179 |
-
""",
|
180 |
-
elem_classes="title"
|
181 |
-
)
|
182 |
-
|
183 |
-
with gr.Row():
|
184 |
-
with gr.Column():
|
185 |
-
with gr.Group(elem_classes="input-section"):
|
186 |
-
prompt_input = gr.Textbox(label="Enter your prompt", placeholder="e.g., A cat", lines=3)
|
187 |
-
generate_button = gr.Button("Generate Image", elem_classes="submit-button")
|
188 |
-
with gr.Column():
|
189 |
-
with gr.Group(elem_classes="output-section") as output_group:
|
190 |
-
image_output = gr.Image(label="Generated Image", interactive=False)
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
)
|
213 |
-
|
214 |
-
if __name__ == "__main__":
|
215 |
-
demo.queue().launch()
|
|
|
172 |
"""
|
173 |
|
174 |
|
175 |
+
with gr.Blocks(css=css) as demo:
|
176 |
+
gr.Markdown(
|
177 |
+
"""
|
178 |
+
# Xylaria Iris Image Generator
|
179 |
+
""",
|
180 |
+
elem_classes="title"
|
181 |
+
)
|
182 |
+
|
183 |
+
with gr.Row():
|
184 |
+
with gr.Column():
|
185 |
+
with gr.Group(elem_classes="input-section"):
|
186 |
+
prompt_input = gr.Textbox(label="Enter your prompt", placeholder="e.g., A cat", lines=3)
|
187 |
+
generate_button = gr.Button("Generate Image", elem_classes="submit-button")
|
188 |
+
with gr.Column():
|
189 |
+
with gr.Group(elem_classes="output-section") as output_group:
|
190 |
+
image_output = gr.Image(label="Generated Image", interactive=False)
|
191 |
+
|
192 |
+
def on_generate_click(prompt):
|
193 |
+
output_group.elem_classes = ["output-section", "animate"]
|
194 |
+
image, _ = generate_image(prompt) # Ignore the improved prompt
|
195 |
+
output_group.elem_classes = ["output-section"]
|
196 |
+
image_b64 = pil_to_base64(image)
|
197 |
+
download_html = f'<a class="download-link" href="{image_b64}" download="generated_image.png">Download Image</a>'
|
198 |
+
|
199 |
+
return image, download_html # No improved prompt to return
|
200 |
+
|
201 |
+
generate_button.click(on_generate_click, inputs=prompt_input, outputs=[image_output, download_link])
|
202 |
+
prompt_input.submit(on_generate_click, inputs=prompt_input, outputs=[image_output, download_link])
|
203 |
+
|
204 |
+
gr.Examples(
|
205 |
+
[["A dog"],
|
206 |
+
["A house on a hill"],
|
207 |
+
["A spaceship"]],
|
208 |
+
inputs=prompt_input
|
209 |
+
)
|
210 |
+
|
211 |
+
if __name__ == "__main__":
|
212 |
+
demo.queue().launch()
|
|
|
|
|
|