diff --git a/modules/upscaler.py b/modules/upscaler.py index 974e4f37..de9a143c 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -1,13 +1,11 @@ -import os -import torch -import modules.core as core - -from ldm_patched.pfn.architecture.RRDB import RRDBNet as ESRGAN -from ldm_patched.contrib.external_upscale_model import ImageUpscaleWithModel from collections import OrderedDict -from modules.config import path_upscale_models -model_filename = os.path.join(path_upscale_models, 'fooocus_upscaler_s409985e5.bin') +import modules.core as core +import torch +from ldm_patched.contrib.external_upscale_model import ImageUpscaleWithModel +from ldm_patched.pfn.architecture.RRDB import RRDBNet as ESRGAN +from modules.config import downloading_upscale_model + opImageUpscaleWithModel = ImageUpscaleWithModel() model = None @@ -18,6 +16,7 @@ def perform_upscale(img): print(f'Upscaling image with shape {str(img.shape)} ...') if model is None: + model_filename = downloading_upscale_model() sd = torch.load(model_filename) sdo = OrderedDict() for k, v in sd.items():