zenafey commited on
Commit
8748fe4
·
1 Parent(s): 62dd3ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -292,6 +292,7 @@ with gr.Blocks(css=css) as demo:
292
  value="3d, cartoon, anime, (deformed eyes, nose, ears, nose), bad anatomy, ugly")
293
  with gr.Column():
294
  text_button = gr.Button("Generate", variant='primary', elem_id="generate")
 
295
 
296
  with gr.Row():
297
  with gr.Column(scale=3):
@@ -382,9 +383,10 @@ with gr.Blocks(css=css) as demo:
382
  with gr.Tab("Gallery"):
383
  gallery_obj = gr.Gallery(height=1000, columns=5)
384
 
385
- text_button.click(flip_text,
386
  inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed, batch_size, batch_count,
387
  gallery_obj], outputs=[image_output, gallery_obj])
 
388
  image_input.upload(get_exif_data, inputs=[image_input], outputs=exif_output)
389
  send_to_txt2img_btn.click(send_to_txt2img, inputs=[image_input],
390
  outputs=[tabs, prompt, negative_prompt, steps, seed,
 
292
  value="3d, cartoon, anime, (deformed eyes, nose, ears, nose), bad anatomy, ugly")
293
  with gr.Column():
294
  text_button = gr.Button("Generate", variant='primary', elem_id="generate")
295
+ stop_btn = gr.Button("Cancel")
296
 
297
  with gr.Row():
298
  with gr.Column(scale=3):
 
383
  with gr.Tab("Gallery"):
384
  gallery_obj = gr.Gallery(height=1000, columns=5)
385
 
386
+ generation_event = text_button.click(flip_text,
387
  inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed, batch_size, batch_count,
388
  gallery_obj], outputs=[image_output, gallery_obj])
389
+ stop_btn.click(fn=None, outputs=None, cancels=[generation_event])
390
  image_input.upload(get_exif_data, inputs=[image_input], outputs=exif_output)
391
  send_to_txt2img_btn.click(send_to_txt2img, inputs=[image_input],
392
  outputs=[tabs, prompt, negative_prompt, steps, seed,