Skip to content

Commit

Permalink
lint recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Feb 6, 2023
1 parent 833fc5c commit 651acf6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/onnx_web/chain/blend_img2img.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 7 additions & 2 deletions api/onnx_web/chain/correct_gfpgan.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,7 +18,12 @@
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

Expand Down
8 changes: 6 additions & 2 deletions api/onnx_web/upscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down

0 comments on commit 651acf6

Please sign in to comment.