redirecting jobs to /jobs after they run, more work with back/forward
This commit is contained in:
16
ai.py
16
ai.py
@@ -1,6 +1,6 @@
|
|||||||
from wtforms import SubmitField, StringField, HiddenField, validators, Form
|
from wtforms import SubmitField, StringField, HiddenField, validators, Form
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from flask import request, render_template
|
from flask import request, render_template, redirect
|
||||||
from main import db, app, ma
|
from main import db, app, ma
|
||||||
from sqlalchemy import Sequence
|
from sqlalchemy import Sequence
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
@@ -23,7 +23,7 @@ from face import Face, FaceFileLink, FaceRefimgLink
|
|||||||
################################################################################
|
################################################################################
|
||||||
# /aistats -> placholder for some sort of stats
|
# /aistats -> placholder for some sort of stats
|
||||||
################################################################################
|
################################################################################
|
||||||
@app.route("/aistats", methods=["GET", "POST"])
|
@app.route("/aistats", methods=["GET"])
|
||||||
@login_required
|
@login_required
|
||||||
def aistats():
|
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 order by 2 desc" )
|
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 order by 2 desc" )
|
||||||
@@ -56,9 +56,9 @@ def run_ai_on():
|
|||||||
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
|
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
|
||||||
job=NewJob( "run_ai_on", 0, None, jex )
|
job=NewJob( "run_ai_on", 0, None, jex )
|
||||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in selected file(s)")
|
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in selected file(s)")
|
||||||
return render_template("base.html")
|
return redirect("/jobs")
|
||||||
|
|
||||||
@app.route("/run_ai_on_import")
|
@app.route("/run_ai_on_import", methods=["GET"])
|
||||||
@login_required
|
@login_required
|
||||||
def run_ai_on_import():
|
def run_ai_on_import():
|
||||||
jex=[]
|
jex=[]
|
||||||
@@ -71,9 +71,9 @@ def run_ai_on_import():
|
|||||||
path_cnt+=1
|
path_cnt+=1
|
||||||
job=NewJob( "run_ai_on", 0, None, jex )
|
job=NewJob( "run_ai_on", 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)")
|
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in import path(s)")
|
||||||
return render_template("base.html")
|
return redirect("/jobs")
|
||||||
|
|
||||||
@app.route("/run_ai_on_storage")
|
@app.route("/run_ai_on_storage", methods=["GET"])
|
||||||
@login_required
|
@login_required
|
||||||
def run_ai_on_storage():
|
def run_ai_on_storage():
|
||||||
jex=[]
|
jex=[]
|
||||||
@@ -86,9 +86,9 @@ def run_ai_on_storage():
|
|||||||
path_cnt+=1
|
path_cnt+=1
|
||||||
job=NewJob( "run_ai_on", 0, None, jex )
|
job=NewJob( "run_ai_on", 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)")
|
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in storage path(s)")
|
||||||
return render_template("base.html")
|
return redirect("/jobs")
|
||||||
|
|
||||||
@app.route("/unmatched_faces")
|
@app.route("/unmatched_faces", methods=["GET"])
|
||||||
@login_required
|
@login_required
|
||||||
def unmatched_faces():
|
def unmatched_faces():
|
||||||
faces=Face.query.join(FaceFileLink).join(FaceRefimgLink, isouter=True).filter(FaceRefimgLink.refimg_id==None).order_by(Face.h.desc()).limit(10).all()
|
faces=Face.query.join(FaceFileLink).join(FaceRefimgLink, isouter=True).filter(FaceRefimgLink.refimg_id==None).order_by(Face.h.desc()).limit(10).all()
|
||||||
|
|||||||
Reference in New Issue
Block a user