aboutsummaryrefslogtreecommitdiffstats
path: root/modules/realesrgan_model.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-05-14 08:46:27 +0000
committerGitHub <noreply@github.com>2023-05-14 08:46:27 +0000
commit80adb6979d46bbb832254004cac4f4f9bec9efb3 (patch)
treee206ee60f9be21e9e20d483213b7d0a610d2bdbd /modules/realesrgan_model.py
parent1dcd6723242c3d691610f9ed937951baea49c2d1 (diff)
parent3ddc76342298ad0b2d14cb571ceb48c0b0c4176d (diff)
downloadstable-diffusion-webui-gfx803-80adb6979d46bbb832254004cac4f4f9bec9efb3.tar.gz
stable-diffusion-webui-gfx803-80adb6979d46bbb832254004cac4f4f9bec9efb3.tar.bz2
stable-diffusion-webui-gfx803-80adb6979d46bbb832254004cac4f4f9bec9efb3.zip
Merge branch 'dev' into find_vae
Diffstat (limited to 'modules/realesrgan_model.py')
-rw-r--r--modules/realesrgan_model.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/realesrgan_model.py b/modules/realesrgan_model.py
index d6079433..c24d8dbb 100644
--- a/modules/realesrgan_model.py
+++ b/modules/realesrgan_model.py
@@ -17,9 +17,9 @@ class UpscalerRealESRGAN(Upscaler):
self.user_path = path
super().__init__()
try:
- from basicsr.archs.rrdbnet_arch import RRDBNet
- from realesrgan import RealESRGANer
- from realesrgan.archs.srvgg_arch import SRVGGNetCompact
+ from basicsr.archs.rrdbnet_arch import RRDBNet # noqa: F401
+ from realesrgan import RealESRGANer # noqa: F401
+ from realesrgan.archs.srvgg_arch import SRVGGNetCompact # noqa: F401
self.enable = True
self.scalers = []
scalers = self.load_models(path)
@@ -28,9 +28,9 @@ class UpscalerRealESRGAN(Upscaler):
for scaler in scalers:
if scaler.local_data_path.startswith("http"):
filename = modelloader.friendly_name(scaler.local_data_path)
- local = next(iter([local_model for local_model in local_model_paths if local_model.endswith(filename + '.pth')]), None)
- if local:
- scaler.local_data_path = local
+ local_model_candidates = [local_model for local_model in local_model_paths if local_model.endswith(f"{filename}.pth")]
+ if local_model_candidates:
+ scaler.local_data_path = local_model_candidates[0]
if scaler.name in opts.realesrgan_enabled_models:
self.scalers.append(scaler)
@@ -47,7 +47,7 @@ class UpscalerRealESRGAN(Upscaler):
info = self.load_model(path)
if not os.path.exists(info.local_data_path):
- print("Unable to load RealESRGAN model: %s" % info.name)
+ print(f"Unable to load RealESRGAN model: {info.name}")
return img
upsampler = RealESRGANer(
@@ -134,6 +134,6 @@ def get_realesrgan_models(scaler):
),
]
return models
- except Exception as e:
+ except Exception:
print("Error making Real-ESRGAN models list:", file=sys.stderr)
print(traceback.format_exc(), file=sys.stderr)