1
0
Fork 0

fix(api): skip upscaling if scale is 1

This commit is contained in:
Sean Sube 2023-01-16 23:01:15 -06:00
parent 227056d976
commit b7c85aa51b
1 changed files with 3 additions and 2 deletions

View File

@ -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)