openfree commited on
Commit
d1aa623
1 Parent(s): 7feb9be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -566,8 +566,8 @@ def infer_upscale(
566
  ):
567
  try:
568
  if input_image is None:
569
- raise ValueError("No input image provided")
570
-
571
  if randomize_seed:
572
  seed = random.randint(0, MAX_SEED)
573
 
@@ -603,16 +603,16 @@ def infer_upscale(
603
  image = image.resize((w_original * upscale_factor, h_original * upscale_factor))
604
 
605
 
606
- return image, seed
607
  except Exception as e:
608
  print(f"Error in infer_upscale: {str(e)}")
609
  return None, seed
610
-
611
 
612
  def check_upscale_input(input_image, *args):
613
  if input_image is None:
614
- raise gr.Error("Please provide an input image for upscaling.")
615
- return input_image, *args
616
 
617
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as app:
618
  loras_state = gr.State(loras)
@@ -769,7 +769,6 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
769
  outputs=history_gallery,
770
  )
771
 
772
-
773
  upscale_button.click(
774
  check_upscale_input,
775
  inputs=[
@@ -787,6 +786,7 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
787
  upscale_steps,
788
  upscale_factor,
789
  controlnet_conditioning_scale,
 
790
  ]
791
  ).then(
792
  infer_upscale,
@@ -799,8 +799,11 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
799
  controlnet_conditioning_scale,
800
  ],
801
  outputs=[upscale_result, upscale_seed_output],
 
802
  )
803
 
 
 
804
  if __name__ == "__main__":
805
  app.queue(max_size=20)
806
  app.launch(debug=True)
 
566
  ):
567
  try:
568
  if input_image is None:
569
+ return None, seed
570
+
571
  if randomize_seed:
572
  seed = random.randint(0, MAX_SEED)
573
 
 
603
  image = image.resize((w_original * upscale_factor, h_original * upscale_factor))
604
 
605
 
606
+
607
  except Exception as e:
608
  print(f"Error in infer_upscale: {str(e)}")
609
  return None, seed
610
+
611
 
612
  def check_upscale_input(input_image, *args):
613
  if input_image is None:
614
+ return gr.update(visible=True), *args, gr.update(visible=True)
615
+ return input_image, *args, gr.update(visible=False)
616
 
617
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as app:
618
  loras_state = gr.State(loras)
 
769
  outputs=history_gallery,
770
  )
771
 
 
772
  upscale_button.click(
773
  check_upscale_input,
774
  inputs=[
 
786
  upscale_steps,
787
  upscale_factor,
788
  controlnet_conditioning_scale,
789
+ upscale_error
790
  ]
791
  ).then(
792
  infer_upscale,
 
799
  controlnet_conditioning_scale,
800
  ],
801
  outputs=[upscale_result, upscale_seed_output],
802
+ show_progress=False
803
  )
804
 
805
+
806
+
807
  if __name__ == "__main__":
808
  app.queue(max_size=20)
809
  app.launch(debug=True)