Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,6 +74,11 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
| 74 |
# Return image, seed, and the used prompts
|
| 75 |
return image, seed, f"Prompt used: {final_prompt}\nNegative prompt used: {full_negative_prompt}"
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
css = """
|
| 79 |
#col-container {
|
|
@@ -231,7 +236,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 231 |
selected_atmosphere_tags = gr.CheckboxGroup(choices=list(atmosphere_tags.keys()), label="Atmosphere Tags")
|
| 232 |
tag_tab.select(lambda: "Tag Selection", inputs=None, outputs=active_tab)
|
| 233 |
|
| 234 |
-
# Link the "Run" button to the infer function
|
| 235 |
run_button.click(
|
| 236 |
infer,
|
| 237 |
inputs=[prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps,
|
|
@@ -242,11 +246,10 @@ with gr.Blocks(css=css) as demo:
|
|
| 242 |
outputs=[result, seed, prompt_info]
|
| 243 |
)
|
| 244 |
|
| 245 |
-
# Enable download functionality
|
| 246 |
download_button.click(
|
| 247 |
download_image,
|
| 248 |
-
inputs=
|
| 249 |
-
outputs=gr.File()
|
| 250 |
)
|
| 251 |
|
| 252 |
-
demo.queue().launch()
|
|
|
|
| 74 |
# Return image, seed, and the used prompts
|
| 75 |
return image, seed, f"Prompt used: {final_prompt}\nNegative prompt used: {full_negative_prompt}"
|
| 76 |
|
| 77 |
+
def download_image(image):
|
| 78 |
+
"""
|
| 79 |
+
Prepares the image for download as a PNG.
|
| 80 |
+
"""
|
| 81 |
+
return image
|
| 82 |
|
| 83 |
css = """
|
| 84 |
#col-container {
|
|
|
|
| 236 |
selected_atmosphere_tags = gr.CheckboxGroup(choices=list(atmosphere_tags.keys()), label="Atmosphere Tags")
|
| 237 |
tag_tab.select(lambda: "Tag Selection", inputs=None, outputs=active_tab)
|
| 238 |
|
|
|
|
| 239 |
run_button.click(
|
| 240 |
infer,
|
| 241 |
inputs=[prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps,
|
|
|
|
| 246 |
outputs=[result, seed, prompt_info]
|
| 247 |
)
|
| 248 |
|
|
|
|
| 249 |
download_button.click(
|
| 250 |
download_image,
|
| 251 |
+
inputs=result,
|
| 252 |
+
outputs=gr.File(label="Download as PNG")
|
| 253 |
)
|
| 254 |
|
| 255 |
+
demo.queue().launch()
|