PommesPeter commited on
Commit
921be30
1 Parent(s): 5a65b34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -19
app.py CHANGED
@@ -522,23 +522,7 @@ def main():
522
  )
523
  with gr.Row():
524
  submit_btn = gr.Button("Submit", variant="primary")
525
- reset_btn = gr.ClearButton(
526
- [
527
- cap,
528
- neg_cap,
529
- resolution,
530
- num_sampling_steps,
531
- cfg_scale,
532
- solver,
533
- t_shift,
534
- seed,
535
- scaling_method,
536
- proportional_attn,
537
- ],
538
- value="Cancel",
539
- variant="stop",
540
-
541
- )
542
  with gr.Column():
543
  output_img = gr.Image(
544
  label="Lumina Generated image",
@@ -618,9 +602,9 @@ def main():
618
  result = infer_ode(args, infer_args, text_encoder, tokenizer, vae, model)
619
  if isinstance(result, ModelFailure):
620
  raise RuntimeError("Model failed to generate the image.")
621
- return result
622
 
623
- submit_btn.click(
624
  on_submit,
625
  [
626
  cap,
@@ -636,6 +620,7 @@ def main():
636
  ],
637
  [output_img, gr_metadata],
638
  )
 
639
 
640
  demo.queue().launch()
641
 
 
522
  )
523
  with gr.Row():
524
  submit_btn = gr.Button("Submit", variant="primary")
525
+ stop_btn = gr.Button("Stop", variant="stop")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
  with gr.Column():
527
  output_img = gr.Image(
528
  label="Lumina Generated image",
 
602
  result = infer_ode(args, infer_args, text_encoder, tokenizer, vae, model)
603
  if isinstance(result, ModelFailure):
604
  raise RuntimeError("Model failed to generate the image.")
605
+ return result
606
 
607
+ submit_event = submit_btn.click(
608
  on_submit,
609
  [
610
  cap,
 
620
  ],
621
  [output_img, gr_metadata],
622
  )
623
+ stop_btn.click(fn=None, inputs=None, outputs=None, cancels=[submit_event])
624
 
625
  demo.queue().launch()
626