diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-04-29 14:42:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-29 14:42:57 +0000 |
commit | 88c7debb02caa5e9b9a2bd519085f1f9134c4b01 (patch) | |
tree | 049d07f32194c1eced8ae4436af819fbfe4f5316 /modules/realesrgan_model.py | |
parent | 67955ca9e5cb6b3cc539333d0a7d9591009bc800 (diff) | |
parent | 97167a576880e4802de081db71372ddc8c16fd92 (diff) | |
download | stable-diffusion-webui-gfx803-88c7debb02caa5e9b9a2bd519085f1f9134c4b01.tar.gz stable-diffusion-webui-gfx803-88c7debb02caa5e9b9a2bd519085f1f9134c4b01.tar.bz2 stable-diffusion-webui-gfx803-88c7debb02caa5e9b9a2bd519085f1f9134c4b01.zip |
Merge branch 'dev' into ui-config-tabs
Diffstat (limited to 'modules/realesrgan_model.py')
-rw-r--r-- | modules/realesrgan_model.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/realesrgan_model.py b/modules/realesrgan_model.py index aad4a629..d6079433 100644 --- a/modules/realesrgan_model.py +++ b/modules/realesrgan_model.py @@ -9,7 +9,7 @@ from realesrgan import RealESRGANer from modules.upscaler import Upscaler, UpscalerData
from modules.shared import cmd_opts, opts
-
+from modules import modelloader
class UpscalerRealESRGAN(Upscaler):
def __init__(self, path):
@@ -23,7 +23,15 @@ class UpscalerRealESRGAN(Upscaler): self.enable = True
self.scalers = []
scalers = self.load_models(path)
+
+ local_model_paths = self.find_models(ext_filter=[".pth"])
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
+
if scaler.name in opts.realesrgan_enabled_models:
self.scalers.append(scaler)
@@ -64,7 +72,9 @@ class UpscalerRealESRGAN(Upscaler): print(f"Unable to find model info: {path}")
return None
- info.local_data_path = load_file_from_url(url=info.data_path, model_dir=self.model_path, progress=True)
+ if info.local_data_path.startswith("http"):
+ info.local_data_path = load_file_from_url(url=info.data_path, model_dir=self.model_path, progress=True)
+
return info
except Exception as e:
print(f"Error making Real-ESRGAN models list: {e}", file=sys.stderr)
|