From c459e9652381ac0054ded68c774e10e5aeaf4fca Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sun, 19 Feb 2023 10:27:05 -0600 Subject: [PATCH] fix(api): report accurate size when face correction is run twice --- api/onnx_web/output.py | 9 +++------ api/onnx_web/params.py | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/api/onnx_web/output.py b/api/onnx_web/output.py index f01b0be0..abcf5c33 100644 --- a/api/onnx_web/output.py +++ b/api/onnx_web/output.py @@ -44,17 +44,14 @@ def json_params( json["params"]["model"] = path.basename(params.model) json["params"]["scheduler"] = get_scheduler_name(params.scheduler) - if upscale is not None and border is not None: - size = upscale.resize(size.add_border(border)) + if border is not None: + json["border"] = border.tojson() + size = size.add_border(border) if upscale is not None: json["upscale"] = upscale.tojson() size = upscale.resize(size) - if border is not None: - json["border"] = border.tojson() - size = size.add_border(border) - json["size"] = size.tojson() return json diff --git a/api/onnx_web/params.py b/api/onnx_web/params.py index 2761e238..c59f7be3 100644 --- a/api/onnx_web/params.py +++ b/api/onnx_web/params.py @@ -265,8 +265,8 @@ class UpscaleParams: face_outscale *= self.face_outscale return Size( - size.width * self.outscale * self.face_outscale, - size.height * self.outscale * self.face_outscale, + size.width * self.outscale * face_outscale, + size.height * self.outscale * face_outscale, ) def tojson(self):