just in case, if location or encoding is null when GenFace is run then return None, and catch this in person and show error on GUI -- for now uploading from a phone does odd things to the image format and fails to work in face_recognition.load_image()
This commit is contained in:
@@ -101,10 +101,13 @@ def AddRefimgToPerson( filename, person ):
|
||||
settings = Settings.query.first()
|
||||
model=AIModel.query.get(settings.default_refimg_model)
|
||||
refimg.face, face_locn = GenFace( filename, model=model.name )
|
||||
os.remove(filename)
|
||||
if not face_locn:
|
||||
raise Exception("Could not find face in uploaded reference image" )
|
||||
return
|
||||
refimg.face_locn = json.dumps(face_locn)
|
||||
refimg.model_used = settings.default_refimg_model
|
||||
refimg.created_on = time.time()
|
||||
os.remove(filename)
|
||||
person.refimg.append(refimg)
|
||||
db.session.add(person)
|
||||
db.session.add(refimg)
|
||||
|
||||
Reference in New Issue
Block a user