From 22414a4378990134c5bb8414991da4beae265b39 Mon Sep 17 00:00:00 2001 From: niten Date: Sat, 7 Jan 2023 17:19:06 -0800 Subject: [PATCH] Add simple logging --- src/objectifier.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/objectifier.py b/src/objectifier.py index b6b9fc6..67f127d 100644 --- a/src/objectifier.py +++ b/src/objectifier.py @@ -91,16 +91,21 @@ def result_to_dict(res, base_url): @app.put("/images/") async def analyze_image(file: UploadFile, request: Request): + print("Initiating file receipt, url: " + str(request.url)) base_url = re.sub(r'\/images\/$', '/analyzed_images/', str(request.url)) infile = open(incoming_dir / file.filename) file_hash = hashlib.sha256() with open(infile, mode="wb") as f: chunk = f.read(buffer_size) while chunk: + print("writing chunk") file_hash.update(chunk) infile.write(chunk) chunk=f.read(buffer_size) + print("saving complete") + print("analyzing image") result = detector.detect_objects(infile, file_hash.hexdigest() + ".png") + print("image analyzed") remove(infile) return result_to_dict(result, base_url)