Update app.py

This commit is contained in:
Siwat Sirichai 2023-09-23 02:39:07 +07:00
parent 099fffbb6f
commit 1b33ce0832
1 changed files with 5 additions and 2 deletions

View File

@ -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__':