From c19f39f9b40197a95f06cfd6ee38a7c12427e344 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Wed, 1 Feb 2023 22:25:53 -0600 Subject: [PATCH] fix(api): handle partial params when formatting output --- api/onnx_web/output.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/onnx_web/output.py b/api/onnx_web/output.py index 12e6cd2e..312ee9dc 100644 --- a/api/onnx_web/output.py +++ b/api/onnx_web/output.py @@ -21,11 +21,20 @@ def json_params( upscale: Optional[UpscaleParams] = None, border: Optional[Border] = None, ) -> Any: + if upscale is not None and border is not None: + size = upscale.resize(size.add_border(border)) + + if upscale is not None: + size = upscale.resize(size) + + if border is not None: + size = size.add_border(border) + return { 'border': border.tojson(), 'output': output, 'params': params.tojson(), - 'size': upscale.resize(size.add_border(border)).tojson(), + 'size': size.tojson(), 'upscale': upscale.tojson(), }