updated stats to use new face tables and be more useful now amount of matches is in the thousands

This commit is contained in:
2021-06-30 14:28:15 +10:00
parent f2bb87c424
commit 78713a6767
2 changed files with 7 additions and 18 deletions

15
ai.py
View File

@@ -5,12 +5,13 @@ from main import db, app, ma
from sqlalchemy import Sequence
from sqlalchemy.exc import SQLAlchemyError
from status import st, Status
from files import Entry, File, FileRefimgLink
from files import Entry, File
from person import Person, PersonRefimgLink
from refimg import Refimg
from flask_login import login_required, current_user
from job import Job, JobExtra, Joblog, NewJob
from face import Face, FaceFileLink, FaceRefimgLink
# pylint: disable=no-member
@@ -21,16 +22,8 @@ from job import Job, JobExtra, Joblog, NewJob
@app.route("/aistats", methods=["GET", "POST"])
@login_required
def aistats():
tmp=db.session.query(Entry,Person).join(File).join(FileRefimgLink).join(Refimg).join(PersonRefimgLink).join(Person).filter(FileRefimgLink.matched==True).all()
entries=[]
last_fname=""
for e, p in tmp:
if last_fname != e.name:
entry = { 'name': e.name, 'people': [] }
entries.append( entry )
last_fname = e.name
entry['people'].append( { 'tag': p.tag } )
return render_template("aistats.html", page_title='Placeholder', entries=entries)
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" )
return render_template("aistats.html", page_title='AI Statistics', stats=stats)
################################################################################