Update 'face_recognition/app/app.py'

This commit is contained in:
fabrice 2019-06-25 17:11:16 +00:00
parent 96ddc93107
commit 16e8558d8b

View File

@ -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]
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:
face2_encoding = pickle.load(file)
return jsonify({'result':str(face_recognition.compare_faces([face_encoding], face2_encoding)[0])})
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):