zenafey commited on
Commit
f450e7f
1 Parent(s): 52018f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -133,7 +133,8 @@ with gr.Blocks(css=css, theme="zenafey/prodia-web") as demo:
133
 
134
  t2i_event_start = t2i_generate_btn.click(
135
  update_btn_start,
136
- outputs=[t2i_generate_btn, t2i_stop_btn]
 
137
  )
138
  t2i_event = t2i_event_start.then(
139
  inference.txt2img,
@@ -142,25 +143,29 @@ with gr.Blocks(css=css, theme="zenafey/prodia-web") as demo:
142
  )
143
  t2i_event_end = t2i_event.then(
144
  update_btn_end,
145
- outputs=[t2i_generate_btn, t2i_stop_btn]
 
146
  )
147
 
148
- t2i_stop_btn.click(fn=update_btn_end, outputs=[t2i_generate_btn, t2i_stop_btn], cancels=[t2i_event])
149
 
150
  image_input.upload(get_exif_data, inputs=[image_input], outputs=exif_output)
151
 
152
  send_to_txt2img_btn.click(
153
  fn=switch_to_t2i,
154
- outputs=[tabs]
 
155
  ).then(
156
  fn=send_to_txt2img,
157
  inputs=[image_input],
158
- outputs=[prompt, negative_prompt, steps, seed, model, sampler, width, height, cfg_scale]
 
159
  )
160
 
161
  i2i_event_start = i2i_generate_btn.click(
162
  update_btn_start,
163
- outputs=[i2i_generate_btn, i2i_stop_btn]
 
164
  )
165
  i2i_event = i2i_event_start.then(inference.img2img,
166
  inputs=[i2i_image_input, i2i_denoising, i2i_prompt, i2i_negative_prompt,
@@ -169,13 +174,15 @@ with gr.Blocks(css=css, theme="zenafey/prodia-web") as demo:
169
  outputs=[i2i_image_output])
170
  i2i_event_end = i2i_event.then(
171
  update_btn_end,
172
- outputs=[i2i_generate_btn, i2i_stop_btn]
 
173
  )
174
- i2i_stop_btn.click(fn=update_btn_end, outputs=[i2i_generate_btn, i2i_stop_btn], cancels=[i2i_event])
175
 
176
  upscale_event_start = upscale_btn.click(
177
  fn=update_btn_start,
178
- outputs=[upscale_btn, upscale_stop_btn]
 
179
  )
180
  upscale_event = upscale_event_start.then(
181
  fn=inference.upscale,
@@ -184,9 +191,10 @@ with gr.Blocks(css=css, theme="zenafey/prodia-web") as demo:
184
  )
185
  upscale_event_end = upscale_event.then(
186
  fn=update_btn_end,
187
- outputs=[upscale_btn, upscale_stop_btn]
 
188
  )
189
 
190
- upscale_stop_btn.click(fn=update_btn_end, outputs=[upscale_btn, upscale_stop_btn], cancels=[upscale_event])
191
 
192
  demo.queue(max_size=20, api_open=False).launch(max_threads=400)
 
133
 
134
  t2i_event_start = t2i_generate_btn.click(
135
  update_btn_start,
136
+ outputs=[t2i_generate_btn, t2i_stop_btn],
137
+ queue=False
138
  )
139
  t2i_event = t2i_event_start.then(
140
  inference.txt2img,
 
143
  )
144
  t2i_event_end = t2i_event.then(
145
  update_btn_end,
146
+ outputs=[t2i_generate_btn, t2i_stop_btn],
147
+ queue=False
148
  )
149
 
150
+ t2i_stop_btn.click(fn=update_btn_end, outputs=[t2i_generate_btn, t2i_stop_btn], cancels=[t2i_event], queue=False)
151
 
152
  image_input.upload(get_exif_data, inputs=[image_input], outputs=exif_output)
153
 
154
  send_to_txt2img_btn.click(
155
  fn=switch_to_t2i,
156
+ outputs=[tabs],
157
+ queue=False
158
  ).then(
159
  fn=send_to_txt2img,
160
  inputs=[image_input],
161
+ outputs=[prompt, negative_prompt, steps, seed, model, sampler, width, height, cfg_scale],
162
+ queue=False
163
  )
164
 
165
  i2i_event_start = i2i_generate_btn.click(
166
  update_btn_start,
167
+ outputs=[i2i_generate_btn, i2i_stop_btn],
168
+ queue=False
169
  )
170
  i2i_event = i2i_event_start.then(inference.img2img,
171
  inputs=[i2i_image_input, i2i_denoising, i2i_prompt, i2i_negative_prompt,
 
174
  outputs=[i2i_image_output])
175
  i2i_event_end = i2i_event.then(
176
  update_btn_end,
177
+ outputs=[i2i_generate_btn, i2i_stop_btn],
178
+ queue=False
179
  )
180
+ i2i_stop_btn.click(fn=update_btn_end, outputs=[i2i_generate_btn, i2i_stop_btn], cancels=[i2i_event], queue=False)
181
 
182
  upscale_event_start = upscale_btn.click(
183
  fn=update_btn_start,
184
+ outputs=[upscale_btn, upscale_stop_btn],
185
+ queue=False
186
  )
187
  upscale_event = upscale_event_start.then(
188
  fn=inference.upscale,
 
191
  )
192
  upscale_event_end = upscale_event.then(
193
  fn=update_btn_end,
194
+ outputs=[upscale_btn, upscale_stop_btn],
195
+ queue=False
196
  )
197
 
198
+ upscale_stop_btn.click(fn=update_btn_end, outputs=[upscale_btn, upscale_stop_btn], cancels=[upscale_event], queue=False)
199
 
200
  demo.queue(max_size=20, api_open=False).launch(max_threads=400)