From 16e8558d8b362e3b8adc098128db0d885d7c7411 Mon Sep 17 00:00:00 2001 From: fabrice Date: Tue, 25 Jun 2019 17:11:16 +0000 Subject: [PATCH] Update 'face_recognition/app/app.py' --- face_recognition/app/app.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/face_recognition/app/app.py b/face_recognition/app/app.py index 5252ca7..71d15fb 100644 --- a/face_recognition/app/app.py +++ b/face_recognition/app/app.py @@ -60,12 +60,13 @@ def check_face(): temporary_img_path = '/tmp/'+str(id)+'.jpg' temporary_pkl_path = '/tmp/'+str(id)+'.pkl' save_img(img, temporary_img_path) - face = face_recognition.load_image_file(temporary_img_path) - face_encoding = face_recognition.face_encodings(face)[0] - minioClient.fget_object('users', str(id), temporary_pkl_path) - with open(temporary_pkl_path, 'rb') as file: - face2_encoding = pickle.load(file) - return jsonify({'result':str(face_recognition.compare_faces([face_encoding], face2_encoding)[0])}) + face_encoding_response = encode_face(temporary_img_path) + if face_encoding_response['success']==True: + minioClient.fget_object('users', str(id), temporary_pkl_path) + with open(temporary_pkl_path, 'rb') as file: + face_encoding = pickle.load(file) + face_encoding_response['result'] = str(face_recognition.compare_faces([face_encoding], face_encoding_response['encoding'])[0]) + return jsonify({'result':face_encoding_response['result'],'success':face_encoding_response['success']}) def check_id(id):