jamino30 commited on
Commit
22696bb
1 Parent(s): ef58374

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -118,14 +118,20 @@ with gr.Blocks(css=css) as demo:
118
  output_quality = gr.Checkbox(label='More Realistic', info='Note: If unchecked, the resulting image will have a more artistic flair.', value=True)
119
 
120
  submit_button = gr.Button('Submit', variant='primary')
121
- download_button = gr.DownloadButton(label='Download Image', value='generated.jpg', visible=False)
122
-
 
 
 
 
123
  submit_button.click(
124
  fn=inference,
125
  inputs=[content_and_output, style_dropdown, style_strength_slider, output_quality],
126
  outputs=[content_and_output]
127
  ).then(
128
- fn=lambda: gr.update(visible=True),
 
 
129
  outputs=[download_button]
130
  )
131
 
 
118
  output_quality = gr.Checkbox(label='More Realistic', info='Note: If unchecked, the resulting image will have a more artistic flair.', value=True)
119
 
120
  submit_button = gr.Button('Submit', variant='primary')
121
+ download_button = gr.DownloadButton(label='Download Image', visible=False)
122
+
123
+ def save_image(img, filename='generated.jpg'):
124
+ img.save(filename)
125
+ return filename
126
+
127
  submit_button.click(
128
  fn=inference,
129
  inputs=[content_and_output, style_dropdown, style_strength_slider, output_quality],
130
  outputs=[content_and_output]
131
  ).then(
132
+ fn=lambda img: save_image(img)
133
+ ).then(
134
+ fn=lambda: gr.update(visible=True, value='generated.jpg'),
135
  outputs=[download_button]
136
  )
137