ai stats has divs not tables, so more compact/responsive, also stats now have clickable link to appropriate AI:<tag> search

This commit is contained in:
2021-09-15 00:23:25 +10:00
parent 10f8e4cc9d
commit b6f672b575
4 changed files with 59 additions and 21 deletions

5
ai.py
View File

@@ -22,6 +22,9 @@ from face import Face, FaceFileLink, FaceRefimgLink
@login_required
def aistats():
stats = db.session.execute( "select p.tag, count(f.id) from person p, face f, face_file_link ffl, face_refimg_link frl, person_refimg_link prl where p.id = prl.person_id and prl.refimg_id = frl.refimg_id and frl.face_id = ffl.face_id and ffl.face_id = f.id group by p.tag" )
cnt_res = db.session.execute( "select count(1) from ( select p.tag from person p, face f, face_file_link ffl, face_refimg_link frl, person_refimg_link prl where p.id = prl.person_id and prl.refimg_id = frl.refimg_id and frl.face_id = ffl.face_id and ffl.face_id = f.id group by p.tag ) as foo" )
num_stats=cnt_res.first()[0]
fstats={}
fstats['files_with_a_face'] = db.session.execute( "select count(distinct file_eid) as count from face_file_link" ).first()[0]
fstats['files_with_a_match'] = db.session.execute( "select count(distinct ffl.file_eid) as count from face_file_link ffl, face_refimg_link frl where frl.face_id = ffl.face_id" ).first()[0]
@@ -33,7 +36,7 @@ def aistats():
fstats['all_matched_faces'] = db.session.execute( "select count(distinct face_id) as count from face_refimg_link" ).first()[0]
fstats['all_unmatched_faces'] = db.session.execute( "select count(f.id) from face f left join face_refimg_link frl on f.id = frl.face_id where frl.refimg_id is null" ).first()[0]
return render_template("aistats.html", page_title='AI Statistics', stats=stats, fstats=fstats )
return render_template("aistats.html", page_title='AI Statistics', stats=stats, num_stats=num_stats, fstats=fstats )
################################################################################