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:
2022-07-10 16:22:35 +10:00
parent 6b7694f382
commit 9f2ecb1901
3 changed files with 10 additions and 2 deletions

View File

@@ -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)