openfree commited on
Commit
fb18855
·
verified ·
1 Parent(s): 6443111

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -14
app.py CHANGED
@@ -606,7 +606,6 @@ def infer_upscale(
606
 
607
  # resize to target desired size
608
  image = image.resize((w_original * upscale_factor, h_original * upscale_factor))
609
- image.save("output.jpg")
610
 
611
  return image, seed
612
  except Exception as e:
@@ -769,20 +768,45 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
769
  inputs=[result, history_gallery],
770
  outputs=history_gallery,
771
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
 
773
- # 업스케일 버튼 이벤트 추가
774
- upscale_button.click(
775
- infer_upscale,
776
- inputs=[
777
- upscale_seed,
778
- upscale_randomize_seed,
779
- upscale_input,
780
- upscale_steps,
781
- upscale_factor,
782
- controlnet_conditioning_scale,
783
- ],
784
- outputs=[upscale_result, upscale_seed_output],
785
- )
786
 
787
  if __name__ == "__main__":
788
  app.queue(max_size=20)
 
606
 
607
  # resize to target desired size
608
  image = image.resize((w_original * upscale_factor, h_original * upscale_factor))
 
609
 
610
  return image, seed
611
  except Exception as e:
 
768
  inputs=[result, history_gallery],
769
  outputs=history_gallery,
770
  )
771
+
772
+
773
+ def check_upscale_input(input_image, *args):
774
+ if input_image is None:
775
+ raise gr.Error("Please provide an input image for upscaling.")
776
+ return input_image, *args
777
+
778
+ upscale_button.click(
779
+ check_upscale_input,
780
+ inputs=[
781
+ upscale_input,
782
+ upscale_seed,
783
+ upscale_randomize_seed,
784
+ upscale_steps,
785
+ upscale_factor,
786
+ controlnet_conditioning_scale,
787
+ ],
788
+ outputs=[
789
+ upscale_input,
790
+ upscale_seed,
791
+ upscale_randomize_seed,
792
+ upscale_steps,
793
+ upscale_factor,
794
+ controlnet_conditioning_scale,
795
+ ]
796
+ ).then(
797
+ infer_upscale,
798
+ inputs=[
799
+ upscale_seed,
800
+ upscale_randomize_seed,
801
+ upscale_input,
802
+ upscale_steps,
803
+ upscale_factor,
804
+ controlnet_conditioning_scale,
805
+ ],
806
+ outputs=[upscale_result, upscale_seed_output],
807
+ )
808
+
809
 
 
 
 
 
 
 
 
 
 
 
 
 
 
810
 
811
  if __name__ == "__main__":
812
  app.queue(max_size=20)