mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
Fix UnboundLocalError when resize gets an invalid upscaler name
The invalid-upscaler warning referenced selected_upscaler, which is only assigned when a matching upscaler was found, so an unknown name (stale infotext, removed upscaler) crashed the resize instead of falling back to plain resampling. https: //claude.ai/code/session_014QWKWgKvMevcuvfCnsYoT2 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -51,7 +51,7 @@ def resize_image(resize_mode: int, im: Image.Image | torch.Tensor, width: int, h
|
||||
else:
|
||||
im = selected_upscaler.scaler.upscale(im, scale, selected_upscaler.name)
|
||||
else:
|
||||
log.warning(f"Resize upscaler: invalid={upscaler_name} fallback={selected_upscaler.name}")
|
||||
log.warning(f"Resize upscaler: invalid={upscaler_name} fallback=resample")
|
||||
log.debug(f"Resize upscaler: available={[u.name for u in shared.sd_upscalers]}")
|
||||
if isinstance(im, Image.Image) and (im.width != w or im.height != h): # probably downsample after upscaler created larger image
|
||||
im = sharpfin.resize(im, (w, h))
|
||||
|
||||
Reference in New Issue
Block a user