openfree commited on
Commit
152fb08
1 Parent(s): 31bfd8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -551,7 +551,7 @@ def process_input(input_image, upscale_factor, **kwargs):
551
  h = h - h % 8
552
 
553
  return input_image.resize((w, h)), w_original, h_original, was_resized
554
-
555
  @spaces.GPU
556
  def infer_upscale(
557
  seed,
@@ -562,7 +562,11 @@ def infer_upscale(
562
  controlnet_conditioning_scale,
563
  progress=gr.Progress(track_tqdm=True),
564
  ):
 
 
 
565
  try:
 
566
  if input_image is None:
567
  return None, seed
568
 
@@ -616,8 +620,8 @@ def infer_upscale(
616
 
617
  def check_upscale_input(input_image, *args):
618
  if input_image is None:
619
- return gr.update(), *args, gr.update(visible=True, value="Please provide an input image for upscaling.")
620
- return input_image, *args, gr.update(visible=False)
621
 
622
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as app:
623
  loras_state = gr.State(loras)
@@ -692,7 +696,7 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
692
 
693
  # 업스케일 관련 UI 추가
694
  with gr.Row():
695
- upscale_button = gr.Button("Upscale")
696
 
697
  with gr.Row():
698
  with gr.Column(scale=4):
@@ -777,15 +781,17 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
777
  )
778
 
779
  upscale_button.click(
780
- check_upscale_input,
781
  inputs=[
782
- upscale_input,
783
  upscale_seed,
784
  upscale_randomize_seed,
 
785
  upscale_steps,
786
  upscale_factor,
787
  controlnet_conditioning_scale,
788
  ],
 
 
789
  outputs=[
790
  upscale_input,
791
  upscale_seed,
@@ -805,8 +811,7 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
805
  upscale_factor,
806
  controlnet_conditioning_scale,
807
  ],
808
- outputs=[upscale_result, upscale_seed_output],
809
- show_progress=False
810
  )
811
 
812
 
 
551
  h = h - h % 8
552
 
553
  return input_image.resize((w, h)), w_original, h_original, was_resized
554
+
555
  @spaces.GPU
556
  def infer_upscale(
557
  seed,
 
562
  controlnet_conditioning_scale,
563
  progress=gr.Progress(track_tqdm=True),
564
  ):
565
+ if input_image is None:
566
+ return None, seed
567
+
568
  try:
569
+
570
  if input_image is None:
571
  return None, seed
572
 
 
620
 
621
  def check_upscale_input(input_image, *args):
622
  if input_image is None:
623
+ return gr.update(interactive=False), *args, gr.update(visible=True, value="Please upload an image for upscaling.")
624
+ return gr.update(interactive=True), *args, gr.update(visible=False)
625
 
626
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as app:
627
  loras_state = gr.State(loras)
 
696
 
697
  # 업스케일 관련 UI 추가
698
  with gr.Row():
699
+ upscale_button = gr.Button("Upscale", interactive=False)
700
 
701
  with gr.Row():
702
  with gr.Column(scale=4):
 
781
  )
782
 
783
  upscale_button.click(
784
+ infer_upscale,
785
  inputs=[
 
786
  upscale_seed,
787
  upscale_randomize_seed,
788
+ upscale_input,
789
  upscale_steps,
790
  upscale_factor,
791
  controlnet_conditioning_scale,
792
  ],
793
+
794
+
795
  outputs=[
796
  upscale_input,
797
  upscale_seed,
 
811
  upscale_factor,
812
  controlnet_conditioning_scale,
813
  ],
814
+ outputs=[upscale_result, upscale_seed_output]
 
815
  )
816
 
817