Skip to content

Commit

Permalink
fix(api): skip upscaling if scale is 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 17, 2023
1 parent 227056d commit b7c85aa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/onnx_web/upscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b7c85aa

Please sign in to comment.