fix up linking between face to refimg when we add that face to a person from right-click
This commit is contained in:
4
TODO
4
TODO
@@ -1,8 +1,8 @@
|
|||||||
###
|
###
|
||||||
#
|
#
|
||||||
# fix all face, right-click options:
|
# fix all face, right-click options:
|
||||||
# partial fix for face to new and existing person - the person and refimg
|
# [DONE] add to new, add to existing
|
||||||
# data are correct, but the face_file_link is not connected (do this in person) - and if we do run AI jobs, they will overwrite it anyway (watch out for race condition)
|
# [TODO] 4 x override*
|
||||||
#
|
#
|
||||||
#1 get override data into view
|
#1 get override data into view
|
||||||
# also all the add ref img/add override, etc are non-functional - FIX the override* stuff first to get table/naming consistency as that is half the problem
|
# also all the add ref img/add override, etc are non-functional - FIX the override* stuff first to get table/naming consistency as that is half the problem
|
||||||
|
|||||||
10
person.py
10
person.py
@@ -295,6 +295,7 @@ def find_persons(who):
|
|||||||
|
|
||||||
class FaceRefimgLinkSchema(ma.SQLAlchemyAutoSchema):
|
class FaceRefimgLinkSchema(ma.SQLAlchemyAutoSchema):
|
||||||
class Meta: model = FaceRefimgLink
|
class Meta: model = FaceRefimgLink
|
||||||
|
face_distance = ma.auto_field() # Explicitly include face_distance
|
||||||
load_instance = True
|
load_instance = True
|
||||||
|
|
||||||
class PersonSchema(ma.SQLAlchemyAutoSchema):
|
class PersonSchema(ma.SQLAlchemyAutoSchema):
|
||||||
@@ -331,6 +332,11 @@ def add_refimg_to_person():
|
|||||||
fname=TempRefimgFile( request.form['refimg_data'], p.tag )
|
fname=TempRefimgFile( request.form['refimg_data'], p.tag )
|
||||||
r=AddRefimgToPerson( fname, p )
|
r=AddRefimgToPerson( fname, p )
|
||||||
|
|
||||||
|
# connect the refimg to the face in the db, now we have added this refimg to the person
|
||||||
|
frl=FaceRefimgLink( face_id=f.id, refimg_id=r.id, face_distance=0 )
|
||||||
|
db.session.add(frl)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
if request.form['search'] == "true":
|
if request.form['search'] == "true":
|
||||||
jex=[]
|
jex=[]
|
||||||
ptype=PathType.query.filter(PathType.name=='Import').first()
|
ptype=PathType.query.filter(PathType.name=='Import').first()
|
||||||
@@ -346,8 +352,10 @@ def add_refimg_to_person():
|
|||||||
|
|
||||||
refimg_schema=RefimgSchema(many=False)
|
refimg_schema=RefimgSchema(many=False)
|
||||||
r_data=refimg_schema.dump(r)
|
r_data=refimg_schema.dump(r)
|
||||||
|
frl_schema=FaceRefimgLinkSchema(many=False)
|
||||||
|
frl_data=refimg_schema.dump(r)
|
||||||
|
|
||||||
return make_response( jsonify( refimg=r_data, who=p.tag, distance='0.0' ) )
|
return make_response( jsonify( refimg=r_data, frl=frl_data ) )
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# /add_force_match_override -> POST
|
# /add_force_match_override -> POST
|
||||||
|
|||||||
Reference in New Issue
Block a user