aboutsummaryrefslogtreecommitdiffstats
path: root/modules/images.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-03-26 08:01:32 +0000
committerAUTOMATIC <16777216c@gmail.com>2023-03-26 08:01:32 +0000
commit4c1ad743e3baf1246db0711aa0107debf036a12b (patch)
treeaa4e0734279d271b638fa8bbbad4c086c67aa7c6 /modules/images.py
parent532ac22b3889e7e1564e9c893622da713a19679c (diff)
downloadstable-diffusion-webui-gfx803-4c1ad743e3baf1246db0711aa0107debf036a12b.tar.gz
stable-diffusion-webui-gfx803-4c1ad743e3baf1246db0711aa0107debf036a12b.tar.bz2
stable-diffusion-webui-gfx803-4c1ad743e3baf1246db0711aa0107debf036a12b.zip
for img2img, use None as upscaler instead of erroring out if the desired upscaler is not found
Diffstat (limited to 'modules/images.py')
-rw-r--r--modules/images.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/images.py b/modules/images.py
index 7030aaaa..b3535070 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -261,9 +261,12 @@ def resize_image(resize_mode, im, width, height, upscaler_name=None):
if scale > 1.0:
upscalers = [x for x in shared.sd_upscalers if x.name == upscaler_name]
- assert len(upscalers) > 0, f"could not find upscaler named {upscaler_name}"
+ if len(upscalers) == 0:
+ upscaler = shared.sd_upscalers[0]
+ print(f"could not find upscaler named {upscaler_name or '<empty string>'}, using {upscaler.name} as a fallback")
+ else:
+ upscaler = upscalers[0]
- upscaler = upscalers[0]
im = upscaler.scaler.upscale(im, scale, upscaler.data_path)
if im.width != w or im.height != h: