From 860393ea8b97261083e3f723630318935e6547df Mon Sep 17 00:00:00 2001 From: Stephanie Date: Wed, 24 Jul 2024 10:52:43 -0400 Subject: [PATCH] fix the photo upload issue Signed-off-by: Stephanie --- .../object_detection/app/object_detection_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/computer_vision/object_detection/app/object_detection_client.py b/recipes/computer_vision/object_detection/app/object_detection_client.py index e843145f..10450c26 100644 --- a/recipes/computer_vision/object_detection/app/object_detection_client.py +++ b/recipes/computer_vision/object_detection/app/object_detection_client.py @@ -23,6 +23,8 @@ window.image(img, use_column_width=True) # convert PIL image into bytes for post request bytes_io = io.BytesIO() + if img.mode in ("RGBA", "P"): + img = img.convert("RGB") img.save(bytes_io, "JPEG") img_bytes = bytes_io.getvalue() b64_image = base64.b64encode(img_bytes).decode('utf-8')