From 1b33ce0832bd9224d46b363ec7bf40587955fcba Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Sat, 23 Sep 2023 02:39:07 +0700 Subject: [PATCH] Update app.py --- access_control_python_server/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/access_control_python_server/app.py b/access_control_python_server/app.py index f81a61e..3cb77de 100644 --- a/access_control_python_server/app.py +++ b/access_control_python_server/app.py @@ -19,8 +19,11 @@ def process_image(): request_data = json.loads(request.data.decode("utf-8")) img_nparr = np.frombuffer(base64.b64decode(request_data['image']), np.uint8) img = cv2.imdecode(img_nparr,cv2.IMREAD_COLOR) - racist_detector = DeepFace.analyze(img) - return racist_detector + try: + racist_detector = DeepFace.analyze(img) + return racist_detector + except: + return [] if __name__ == '__main__':