diff --git a/api/onnx_web/chain/correct_gfpgan.py b/api/onnx_web/chain/correct_gfpgan.py index b43489bb..b27d4299 100644 --- a/api/onnx_web/chain/correct_gfpgan.py +++ b/api/onnx_web/chain/correct_gfpgan.py @@ -4,7 +4,6 @@ from os import path import numpy as np from PIL import Image - from ..params import DeviceParams, ImageParams, StageParams, UpscaleParams from ..server.device_pool import JobContext from ..utils import ServerContext, run_gc diff --git a/api/onnx_web/chain/upscale_resrgan.py b/api/onnx_web/chain/upscale_resrgan.py index 395d8706..f311945e 100644 --- a/api/onnx_web/chain/upscale_resrgan.py +++ b/api/onnx_web/chain/upscale_resrgan.py @@ -76,9 +76,7 @@ def load_resrgan( logger.debug("loading Real ESRGAN upscale model from %s", model_path) # TODO: shouldn't need the PTH file - model_path_pth = path.join( - server.cache_path, ("%s.pth" % params.upscale_model) - ) + model_path_pth = path.join(server.cache_path, ("%s.pth" % params.upscale_model)) upsampler = RealESRGANer( scale=params.scale, model_path=model_path_pth, diff --git a/api/onnx_web/diffusion/load.py b/api/onnx_web/diffusion/load.py index 919694d3..d0658dc4 100644 --- a/api/onnx_web/diffusion/load.py +++ b/api/onnx_web/diffusion/load.py @@ -20,7 +20,7 @@ from diffusers import ( try: from diffusers import DEISMultistepScheduler -except: +except ImportError: from .stub_scheduler import StubScheduler as DEISMultistepScheduler from ..params import DeviceParams, Size diff --git a/api/onnx_web/diffusion/stub_scheduler.py b/api/onnx_web/diffusion/stub_scheduler.py index 8de415a0..8377236a 100644 --- a/api/onnx_web/diffusion/stub_scheduler.py +++ b/api/onnx_web/diffusion/stub_scheduler.py @@ -1,6 +1,8 @@ from typing import Any -class StubScheduler(): - def step(self, model_output: Any, timestep: int, sample: Any, return_dict: bool = True) -> None: - raise NotImplemented("scheduler not available, try updating diffusers") +class StubScheduler: + def step( + self, model_output: Any, timestep: int, sample: Any, return_dict: bool = True + ) -> None: + raise NotImplementedError("scheduler not available, try updating diffusers")