panelforge commited on
Commit
df26b65
·
verified ·
1 Parent(s): c8b9716

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -131,7 +131,10 @@ with gr.Blocks(css=css) as demo:
131
  gr.Markdown("""# Rainbow Media X""")
132
 
133
  # Display result image at the top
134
- result = gr.Image(label="Result", show_label=False, elem_id="result")
 
 
 
135
 
136
  # Add a textbox to display the prompts used for generation
137
  prompt_info = gr.Textbox(label="Prompts Used", lines=3, interactive=False, elem_id="prompt-info")
@@ -228,6 +231,7 @@ with gr.Blocks(css=css) as demo:
228
  selected_atmosphere_tags = gr.CheckboxGroup(choices=list(atmosphere_tags.keys()), label="Atmosphere Tags")
229
  tag_tab.select(lambda: "Tag Selection", inputs=None, outputs=active_tab)
230
 
 
231
  run_button.click(
232
  infer,
233
  inputs=[prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps,
@@ -238,4 +242,11 @@ with gr.Blocks(css=css) as demo:
238
  outputs=[result, seed, prompt_info]
239
  )
240
 
 
 
 
 
 
 
 
241
  demo.queue().launch()
 
131
  gr.Markdown("""# Rainbow Media X""")
132
 
133
  # Display result image at the top
134
+ result = gr.Image(label="Result", show_label=False, elem_id="result", type="pil")
135
+
136
+ # Add a download button
137
+ download_button = gr.Button("Download as PNG", elem_id="download-button")
138
 
139
  # Add a textbox to display the prompts used for generation
140
  prompt_info = gr.Textbox(label="Prompts Used", lines=3, interactive=False, elem_id="prompt-info")
 
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
  outputs=[result, seed, prompt_info]
243
  )
244
 
245
+ # Enable download functionality
246
+ download_button.click(
247
+ download_image,
248
+ inputs=[result],
249
+ outputs=gr.File()
250
+ )
251
+
252
  demo.queue().launch()