multimodalart HF staff commited on
Commit
daadb28
1 Parent(s): 345d7b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +68 -47
app.py CHANGED
@@ -716,92 +716,113 @@ with gr.Blocks(css="style.css") as demo:
716
  src_prompt,
717
  src_cfg_scale,
718
  mask_type
719
-
720
-
721
  ],
722
- outputs=[sega_edited_image, reconstruct_button, do_reconstruction, reconstruction, wts, zs,attention_store, text_cross_attention_maps, do_inversion, share_btn_container])
 
 
723
  # .success(fn=update_gallery_display, inputs= [prev_output_image, sega_edited_image], outputs = [gallery, gallery, prev_output_image])
724
 
725
 
726
  input_image.change(
727
  fn = reset_do_inversion,
728
  outputs = [do_inversion],
729
- queue = False).then(
 
 
730
  fn = randomize_seed_fn,
731
  inputs = [seed, randomize_seed],
732
- outputs = [seed], queue = False)
 
 
 
 
733
  # Automatically start inverting upon input_image change
734
- input_image.upload(fn = crop_image, inputs = [input_image], outputs = [input_image],queue=False).then(
 
 
 
 
 
 
735
  fn = reset_do_inversion,
736
  outputs = [do_inversion],
737
- queue = False).then(
 
 
738
  fn = randomize_seed_fn,
739
  inputs = [seed, randomize_seed],
740
- outputs = [seed], queue = False).then(fn = caption_image,
 
 
 
741
  inputs = [input_image],
742
- outputs = [tar_prompt, image_caption]).then(fn = update_inversion_progress_visibility, inputs =[input_image,do_inversion],
743
- outputs=[inversion_progress],queue=False).then(
744
- fn=load_and_invert,
745
- inputs=[input_image,
746
- do_inversion,
747
- seed, randomize_seed,
748
- wts, zs,
749
- src_prompt,
750
- # tar_prompt,
751
- steps,
752
- src_cfg_scale,
753
- skip,
754
- tar_cfg_scale,
755
- ],
756
- # outputs=[ddpm_edited_image, wts, zs, do_inversion],
757
- outputs=[wts, zs, do_inversion, inversion_progress],
758
- ).then(fn = update_inversion_progress_visibility, inputs =[input_image,do_inversion],
759
- outputs=[inversion_progress],queue=False).then(
760
- lambda: gr.update(visible=False),
761
- outputs=[reconstruct_button]).then(
762
- fn = reset_do_reconstruction,
763
- outputs = [do_reconstruction],
764
- queue = False)
765
-
766
 
767
  # Repeat inversion (and reconstruction) when these params are changed:
768
  src_prompt.change(
769
  fn = reset_do_inversion,
770
- outputs = [do_inversion], queue = False).then(
 
 
771
  fn = reset_do_reconstruction,
772
- outputs = [do_reconstruction], queue = False)
 
 
773
 
774
  steps.change(
775
  fn = reset_do_inversion,
776
- outputs = [do_inversion], queue = False).then(
 
 
777
  fn = reset_do_reconstruction,
778
- outputs = [do_reconstruction], queue = False)
779
-
 
780
 
781
  src_cfg_scale.change(
782
  fn = reset_do_inversion,
783
- outputs = [do_inversion], queue = False).then(
 
 
784
  fn = reset_do_reconstruction,
785
- outputs = [do_reconstruction], queue = False)
 
 
786
 
787
  # Repeat only reconstruction these params are changed:
788
-
789
  tar_prompt.change(
790
  fn = reset_do_reconstruction,
791
- outputs = [do_reconstruction], queue = False)
 
 
792
 
793
  tar_cfg_scale.change(
794
  fn = reset_do_reconstruction,
795
- outputs = [do_reconstruction], queue = False)
 
 
796
 
797
  skip.change(
798
  fn = reset_do_inversion,
799
- outputs = [do_inversion], queue = False).then(
 
 
800
  fn = reset_do_reconstruction,
801
- outputs = [do_reconstruction], queue = False)
 
 
802
 
803
- seed.change(fn=reset_do_inversion, outputs=[do_inversion], queue=False).then(
804
- fn=reset_do_reconstruction, outputs=[do_reconstruction], queue=False
 
 
 
 
 
 
805
  )
806
 
807
  dropdown1.change(fn=update_dropdown_parms, inputs = [dropdown1], outputs = [guidnace_scale_1,warmup_1, threshold_1], queue=False)
@@ -878,5 +899,5 @@ with gr.Blocks(css="style.css") as demo:
878
  cache_examples=True
879
  )
880
 
881
- demo.queue()
882
  demo.launch()
 
716
  src_prompt,
717
  src_cfg_scale,
718
  mask_type
 
 
719
  ],
720
+ outputs=[sega_edited_image, reconstruct_button, do_reconstruction, reconstruction, wts, zs,attention_store, text_cross_attention_maps, do_inversion, share_btn_container]
721
+
722
+ )
723
  # .success(fn=update_gallery_display, inputs= [prev_output_image, sega_edited_image], outputs = [gallery, gallery, prev_output_image])
724
 
725
 
726
  input_image.change(
727
  fn = reset_do_inversion,
728
  outputs = [do_inversion],
729
+ queue=False,
730
+ concurrency_limit=None
731
+ ).then(
732
  fn = randomize_seed_fn,
733
  inputs = [seed, randomize_seed],
734
+ outputs = [seed],
735
+ queue=False,
736
+ concurrency_limit=None
737
+ )
738
+
739
  # Automatically start inverting upon input_image change
740
+ input_image.upload(
741
+ fn = crop_image,
742
+ inputs = [input_image],
743
+ outputs = [input_image],
744
+ queue=False,
745
+ concurrency_limit=None,
746
+ ).then(
747
  fn = reset_do_inversion,
748
  outputs = [do_inversion],
749
+ queue=False,
750
+ concurrency_limit=None
751
+ ).then(
752
  fn = randomize_seed_fn,
753
  inputs = [seed, randomize_seed],
754
+ outputs = [seed],
755
+ queue=False,
756
+ concurrency_limit=None
757
+ ).then(fn = caption_image,
758
  inputs = [input_image],
759
+ outputs = [tar_prompt, image_caption],
760
+ queue=False,
761
+ concurrency_limit=None
762
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
 
764
  # Repeat inversion (and reconstruction) when these params are changed:
765
  src_prompt.change(
766
  fn = reset_do_inversion,
767
+ outputs = [do_inversion],
768
+ queue = False
769
+ ).then(
770
  fn = reset_do_reconstruction,
771
+ outputs = [do_reconstruction],
772
+ queue = False
773
+ )
774
 
775
  steps.change(
776
  fn = reset_do_inversion,
777
+ outputs = [do_inversion],
778
+ queue = False
779
+ ).then(
780
  fn = reset_do_reconstruction,
781
+ outputs = [do_reconstruction],
782
+ queue = False
783
+ )
784
 
785
  src_cfg_scale.change(
786
  fn = reset_do_inversion,
787
+ outputs = [do_inversion],
788
+ queue = False
789
+ ).then(
790
  fn = reset_do_reconstruction,
791
+ outputs = [do_reconstruction],
792
+ queue = False
793
+ )
794
 
795
  # Repeat only reconstruction these params are changed:
 
796
  tar_prompt.change(
797
  fn = reset_do_reconstruction,
798
+ outputs = [do_reconstruction],
799
+ queue = False
800
+ )
801
 
802
  tar_cfg_scale.change(
803
  fn = reset_do_reconstruction,
804
+ outputs = [do_reconstruction],
805
+ queue = False
806
+ )
807
 
808
  skip.change(
809
  fn = reset_do_inversion,
810
+ outputs = [do_inversion],
811
+ queue = False
812
+ ).then(
813
  fn = reset_do_reconstruction,
814
+ outputs = [do_reconstruction],
815
+ queue = False
816
+ )
817
 
818
+ seed.change(
819
+ fn=reset_do_inversion,
820
+ outputs=[do_inversion],
821
+ queue=False
822
+ ).then(
823
+ fn=reset_do_reconstruction,
824
+ outputs=[do_reconstruction],
825
+ queue=False
826
  )
827
 
828
  dropdown1.change(fn=update_dropdown_parms, inputs = [dropdown1], outputs = [guidnace_scale_1,warmup_1, threshold_1], queue=False)
 
899
  cache_examples=True
900
  )
901
 
902
+ demo.queue(default_concurrency_limit=1)
903
  demo.launch()