Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -563,7 +563,7 @@ def infer_upscale(
|
|
| 563 |
progress=gr.Progress(track_tqdm=True),
|
| 564 |
):
|
| 565 |
if input_image is None:
|
| 566 |
-
return None, seed
|
| 567 |
|
| 568 |
try:
|
| 569 |
|
|
@@ -609,15 +609,15 @@ def infer_upscale(
|
|
| 609 |
# resize to target desired size
|
| 610 |
image = image.resize((w_original * upscale_factor, h_original * upscale_factor))
|
| 611 |
|
| 612 |
-
return image, seed
|
| 613 |
|
|
|
|
|
|
|
| 614 |
except Exception as e:
|
| 615 |
print(f"Error in infer_upscale: {str(e)}")
|
| 616 |
import traceback
|
| 617 |
traceback.print_exc()
|
| 618 |
-
return None, seed
|
| 619 |
|
| 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.")
|
|
@@ -785,8 +785,9 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
|
|
| 785 |
inputs=[upscale_input],
|
| 786 |
outputs=[upscale_button]
|
| 787 |
)
|
| 788 |
-
|
| 789 |
|
|
|
|
|
|
|
| 790 |
upscale_button.click(
|
| 791 |
infer_upscale,
|
| 792 |
inputs=[
|
|
@@ -797,17 +798,15 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
|
|
| 797 |
upscale_factor,
|
| 798 |
controlnet_conditioning_scale,
|
| 799 |
],
|
| 800 |
-
|
| 801 |
-
|
| 802 |
outputs=[
|
| 803 |
-
|
| 804 |
-
|
| 805 |
-
upscale_randomize_seed,
|
| 806 |
upscale_steps,
|
| 807 |
upscale_factor,
|
| 808 |
controlnet_conditioning_scale,
|
|
|
|
| 809 |
upscale_error
|
| 810 |
-
]
|
| 811 |
).then(
|
| 812 |
infer_upscale,
|
| 813 |
inputs=[
|
|
|
|
| 563 |
progress=gr.Progress(track_tqdm=True),
|
| 564 |
):
|
| 565 |
if input_image is None:
|
| 566 |
+
return None, seed, gr.update(), gr.update(), gr.update(), gr.update(), gr.update(visible=True, value="Please upload an image for upscaling.")
|
| 567 |
|
| 568 |
try:
|
| 569 |
|
|
|
|
| 609 |
# resize to target desired size
|
| 610 |
image = image.resize((w_original * upscale_factor, h_original * upscale_factor))
|
| 611 |
|
|
|
|
| 612 |
|
| 613 |
+
|
| 614 |
+
return image, seed, num_inference_steps, upscale_factor, controlnet_conditioning_scale, gr.update(), gr.update(visible=False)
|
| 615 |
except Exception as e:
|
| 616 |
print(f"Error in infer_upscale: {str(e)}")
|
| 617 |
import traceback
|
| 618 |
traceback.print_exc()
|
| 619 |
+
return None, seed, gr.update(), gr.update(), gr.update(), gr.update(), gr.update(visible=True, value=f"Error: {str(e)}")
|
| 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.")
|
|
|
|
| 785 |
inputs=[upscale_input],
|
| 786 |
outputs=[upscale_button]
|
| 787 |
)
|
|
|
|
| 788 |
|
| 789 |
+
upscale_error = gr.Markdown(visible=False, value="")
|
| 790 |
+
|
| 791 |
upscale_button.click(
|
| 792 |
infer_upscale,
|
| 793 |
inputs=[
|
|
|
|
| 798 |
upscale_factor,
|
| 799 |
controlnet_conditioning_scale,
|
| 800 |
],
|
|
|
|
|
|
|
| 801 |
outputs=[
|
| 802 |
+
upscale_result,
|
| 803 |
+
upscale_seed_output,
|
|
|
|
| 804 |
upscale_steps,
|
| 805 |
upscale_factor,
|
| 806 |
controlnet_conditioning_scale,
|
| 807 |
+
upscale_randomize_seed,
|
| 808 |
upscale_error
|
| 809 |
+
],
|
| 810 |
).then(
|
| 811 |
infer_upscale,
|
| 812 |
inputs=[
|