Update 'face_recognition/app/app.py'

This commit is contained in:
fabrice 2019-06-24 12:52:02 +00:00
parent 8144eb6805
commit 5bb85d7277

View File

@ -41,11 +41,13 @@ def new_user_id():
def new_face(): def new_face():
id = request.args.get('id', None) id = request.args.get('id', None)
img = request.args.get('encoded_string', None) img = request.args.get('encoded_string', None)
img += "=" * ((4 - len(img) % 4) % 4)
img = bytes(img, encoding='utf-8')
#print(img, flush=True) #print(img, flush=True)
#imgdata = base64.b64decode(img) #imgdata = base64.b64decode(img)
#with open('/tmp/'+str(id), 'wb') as file: #with open('/tmp/'+str(id), 'wb') as file:
# file.write(bytearray(imgdata)) # file.write(bytearray(imgdata))
save_img(img.encode(), '/tmp/'+str(id)+'.jpg') save_img(img, '/tmp/'+str(id)+'.jpg')
#to debug send img #to debug send img
#minioClient.fput_object('users', str(id)+'.jpg', '/tmp/'+str(id)+'.jpg') #minioClient.fput_object('users', str(id)+'.jpg', '/tmp/'+str(id)+'.jpg')
#face = face_recognition.load_image_file('/tmp/'+str(id)+'.jpg') #face = face_recognition.load_image_file('/tmp/'+str(id)+'.jpg')