From b7c85aa51b36a3a01a369835629b745604515855 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Mon, 16 Jan 2023 23:01:15 -0600 Subject: [PATCH] fix(api): skip upscaling if scale is 1 --- api/onnx_web/upscale.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/onnx_web/upscale.py b/api/onnx_web/upscale.py index 6be9abc12..32c1296fb 100644 --- a/api/onnx_web/upscale.py +++ b/api/onnx_web/upscale.py @@ -148,10 +148,11 @@ def make_resrgan(ctx: ServerContext, params: UpscaleParams, tile=0): def upscale_resrgan(ctx: ServerContext, params: UpscaleParams, source_image: Image) -> Image: print('upscaling image with Real ESRGAN', params) - image = np.array(source_image) + output = np.array(source_image) upsampler = make_resrgan(ctx, params, tile=512) - output, _ = upsampler.enhance(image, outscale=params.outscale) + if params.scale > 1: + output, _ = upsampler.enhance(output, outscale=params.outscale) if params.faces: output = upscale_gfpgan(ctx, params, output, upsampler=upsampler)