diff --git a/api/onnx_web/chain/pipeline.py b/api/onnx_web/chain/pipeline.py index 26b76fad..8d6c6816 100644 --- a/api/onnx_web/chain/pipeline.py +++ b/api/onnx_web/chain/pipeline.py @@ -169,7 +169,7 @@ class ChainPipeline: if stage_pipe.max_tile > 0: tile = min(stage_pipe.max_tile, stage_params.tile_size) - callback.tile = 0 # reset this either way + callback.tile = 0 # reset this either way if must_tile: logger.info( "image contains sources or is larger than tile size of %s, tiling stage", @@ -270,7 +270,9 @@ class ChainPipeline: len(stage_sources), ) - callback.result = stage_sources # this has just been set to the result of the last stage + callback.result = ( + stage_sources # this has just been set to the result of the last stage + ) if is_debug(): for j, image in enumerate(stage_sources.as_image()): diff --git a/api/onnx_web/server/api.py b/api/onnx_web/server/api.py index a0310b24..7d1fa79d 100644 --- a/api/onnx_web/server/api.py +++ b/api/onnx_web/server/api.py @@ -138,7 +138,7 @@ def image_reply( logger.error("metadata and outputs must be the same length") return error_reply("metadata and outputs must be the same length") - data["metadata"] = metadata + data["metadata"] = [m.tojson() for m in metadata] data["outputs"] = outputs return jsonify([data]) @@ -673,7 +673,7 @@ def job_status(server: ServerContext, pool: DevicePoolExecutor): outputs = None metadata = None if progress.result is not None and len(progress.result) > 0: - # TODO: progress results should be a list of filenames and image metadata + # TODO: the names should be attached to the result somehow rather than recomputing them outputs = make_output_names(server, job_name, len(progress.result)) metadata = progress.result.metadata diff --git a/api/onnx_web/worker/context.py b/api/onnx_web/worker/context.py index 39880f54..a052778a 100644 --- a/api/onnx_web/worker/context.py +++ b/api/onnx_web/worker/context.py @@ -121,9 +121,7 @@ class WorkerContext: with self.idle.get_lock(): self.idle.value = idle - def set_progress( - self, steps: int, stages: int = 0, tiles: int = 0 - ) -> None: + def set_progress(self, steps: int, stages: int = 0, tiles: int = 0) -> None: if self.job is None: raise RuntimeError("no job on which to set progress")