can now do an AI search if we add refimg to new/existing person, cleaned up that dialog to look better with buttons for those options rather than a link. Noticed BUG-100, 2 x mich in one image
This commit is contained in:
1
BUGs
1
BUGs
@@ -1 +1,2 @@
|
||||
### Next: 100
|
||||
BUG-100: I managed to get 2 photos matching mich in the NOT_WORKING photo (probably dif refimgs but same p.tag?)
|
||||
|
||||
2
TODO
2
TODO
@@ -3,7 +3,7 @@
|
||||
- allow face to be used to:
|
||||
[DONE] - create person
|
||||
[DONE] - add to existing person
|
||||
--> still need to consider whether we trigger an AI search immediately (for these 2 options)
|
||||
[DONE] --> can choose to do AI search (for these 2 options)
|
||||
[DONE] - ignore/not a face/too young
|
||||
[DONE] - redraw 'ignore's as a greyed out box?
|
||||
[DONE] - menu should only allow override IF we have put override on...
|
||||
|
||||
@@ -309,9 +309,9 @@ function CreatePersonAndRefimg( key )
|
||||
})
|
||||
}
|
||||
|
||||
function AddRefImgTo( person_id, key )
|
||||
function AddRefimgTo( person_id, key, search )
|
||||
{
|
||||
d='&face_id='+item[key].id+'&person_id='+person_id+'&refimg_data='+item[key].refimg_data
|
||||
d='&face_id='+item[key].id+'&person_id='+person_id+'&refimg_data='+item[key].refimg_data+'&search='+search
|
||||
$.ajax({ type: 'POST', data: d, url: '/add_refimg_to_person',
|
||||
success: function(data) {
|
||||
objs[current].faces[item[key].which_face].who=data.who
|
||||
@@ -328,21 +328,30 @@ function AddRefImgTo( person_id, key )
|
||||
// and displays results in #search_person_results
|
||||
function SearchForPerson(content, key, face_id, face_pos, type_id)
|
||||
{
|
||||
console.log( 'type_id=' + item[key].type_id )
|
||||
// make URI safe
|
||||
who = encodeURIComponent( $('#stext').val() )
|
||||
// call ajax to find ppl
|
||||
$.ajax({ type: 'POST', data: null, url: '/find_persons/'+ who,
|
||||
success: function(data) {
|
||||
for( var el in data ) {
|
||||
content+='<div class="row">'
|
||||
var person = data[el];
|
||||
// NMO_1 is a non-match-override type_id==1 (or force match to existing person)
|
||||
if( key == "NMO_1" )
|
||||
content+= '<a role=button class="link link-primary" onClick="OverrideForceMatch('+person.id+',\''+key+'\')">'
|
||||
+person.firstname+' '+person.surname+' ('+person.tag+')</a><br>'
|
||||
{
|
||||
func='OverrideForceMatch('+person.id+',\''+key+'\' )'
|
||||
func_sn=func_func_ao=func
|
||||
}
|
||||
if( key == 'no_match_new_refimg' )
|
||||
content+= '<a role=button class="link link-primary" onClick="AddRefImgTo('+person.id+',\''+key+'\')">'
|
||||
+person.firstname+' '+person.surname+' ('+person.tag+')</a><br>'
|
||||
{
|
||||
func='AddRefimgTo('+person.id+',\''+key+'\''
|
||||
func_sn=func+ ', true )'
|
||||
func_ao=func+ ', false )'
|
||||
}
|
||||
content+= '<div class="col">' + person.tag + ' (' + person.firstname+' '+person.surname+ ') </div><div class="col input-group">'
|
||||
content+= '<button onClick="'+func_sn+'" class="btn btn-success py-1 input-group-prepend">Add & search now</a> '
|
||||
content+= '<button onClick="'+func_ao+'" class="btn btn-outline-success py-1 input-group-append">Add only</a></div>'
|
||||
content+='</div class="row">'
|
||||
}
|
||||
$('#search_person_results').html( content )
|
||||
}
|
||||
|
||||
18
person.py
18
person.py
@@ -10,6 +10,9 @@ from flask_login import login_required, current_user
|
||||
from werkzeug.utils import secure_filename
|
||||
from shared import GenFace, GenThumb
|
||||
from face import Face, FaceRefimgLink, FaceOverrideType, FaceNoMatchOverride, FaceManualOverride
|
||||
from path import Path, PathType
|
||||
from job import JobExtra, NewJob
|
||||
|
||||
import os
|
||||
import json
|
||||
import time
|
||||
@@ -310,6 +313,21 @@ def add_refimg_to_person():
|
||||
fname=TempRefimgFile( request.form['refimg_data'], p.tag )
|
||||
AddRefimgToPerson( fname, p )
|
||||
|
||||
if request.form['search'] == "true":
|
||||
jex=[]
|
||||
ptype=PathType.query.filter(PathType.name=='Import').first()
|
||||
jex.append( JobExtra( name=f"person", value="all" ) )
|
||||
jex.append( JobExtra( name=f"path_type", value=ptype.id ) )
|
||||
job=NewJob( "run_ai_on_path", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in import path(s)")
|
||||
|
||||
jex=[]
|
||||
ptype=PathType.query.filter(PathType.name=='Storage').first()
|
||||
jex.append( JobExtra( name=f"person", value="all" ) )
|
||||
jex.append( JobExtra( name=f"path_type", value=ptype.id ) )
|
||||
job=NewJob( "run_ai_on_path", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in storage path(s)")
|
||||
|
||||
resp['who']=p.tag
|
||||
resp['distance']='0.0'
|
||||
return resp
|
||||
|
||||
Reference in New Issue
Block a user