diff --git a/api/onnx_web/chain/blend_img2img.py b/api/onnx_web/chain/blend_img2img.py index a66b0fd6..d66e6f83 100644 --- a/api/onnx_web/chain/blend_img2img.py +++ b/api/onnx_web/chain/blend_img2img.py @@ -1,10 +1,10 @@ from logging import getLogger +from typing import Optional import numpy as np import torch from diffusers import OnnxStableDiffusionImg2ImgPipeline from PIL import Image -from typing import Optional from ..device_pool import JobContext from ..diffusion.load import load_pipeline diff --git a/api/onnx_web/chain/correct_gfpgan.py b/api/onnx_web/chain/correct_gfpgan.py index 5b9018de..2f19c98b 100644 --- a/api/onnx_web/chain/correct_gfpgan.py +++ b/api/onnx_web/chain/correct_gfpgan.py @@ -1,10 +1,10 @@ from logging import getLogger from os import path +from typing import Optional import numpy as np from gfpgan import GFPGANer from PIL import Image -from typing import Optional from ..device_pool import JobContext from ..params import DeviceParams, ImageParams, StageParams, UpscaleParams @@ -18,7 +18,12 @@ last_pipeline_instance: Optional[GFPGANer] = None last_pipeline_params: Optional[str] = None -def load_gfpgan(server: ServerContext, stage: StageParams, upscale: UpscaleParams, device: DeviceParams): +def load_gfpgan( + server: ServerContext, + stage: StageParams, + upscale: UpscaleParams, + device: DeviceParams, +): global last_pipeline_instance global last_pipeline_params diff --git a/api/onnx_web/upscale.py b/api/onnx_web/upscale.py index d383c8b7..f28724b6 100644 --- a/api/onnx_web/upscale.py +++ b/api/onnx_web/upscale.py @@ -35,7 +35,9 @@ def run_upscale_correction( if upscale.scale > 1: if "esrgan" in upscale.upscale_model: - resr_stage = StageParams(tile_size=stage.tile_size, outscale=upscale.outscale) + resr_stage = StageParams( + tile_size=stage.tile_size, outscale=upscale.outscale + ) chain.append((upscale_resrgan, resr_stage, None)) elif "stable-diffusion" in upscale.upscale_model: mini_tile = min(SizeChart.mini, stage.tile_size) @@ -45,7 +47,9 @@ def run_upscale_correction( logger.warn("unknown upscaling model: %s", upscale.upscale_model) if upscale.faces: - face_stage = StageParams(tile_size=stage.tile_size, outscale=upscale.face_outscale) + face_stage = StageParams( + tile_size=stage.tile_size, outscale=upscale.face_outscale + ) if "codeformer" in upscale.correction_model: chain.append((correct_codeformer, face_stage, None)) elif "gfpgan" in upscale.correction_model: