diff --git a/src/objectifier.py b/src/objectifier.py index 0206af9..d9184f4 100644 --- a/src/objectifier.py +++ b/src/objectifier.py @@ -85,8 +85,8 @@ def detection_to_dict(d): def result_to_dict(res, base_url): return { - "labels": map(lambda d: d.label, res.detections), - "detections": map(detection_to_dict, res.detections), + "labels": list(map(lambda d: d.label, res.detections)), + "detections": list(map(detection_to_dict, res.detections)), "output": base_url + res.outfile, } @@ -128,9 +128,7 @@ def analyze_image(request: Request, image: UploadFile): result = detector.detect_objects(infile, file_hash.hexdigest() + ".png") print("image analyzed") remove(infile) - ret = result_to_dict(result, base_url) - print(ret) - return ret + return result_to_dict(result, base_url) @app.get("/analyzed_images/${image_name}", response_class=FileResponse) def get_analyzed_image(image_name):