diff --git a/application/endpoints.py b/application/endpoints.py index a379859..525d1f6 100644 --- a/application/endpoints.py +++ b/application/endpoints.py @@ -38,6 +38,7 @@ class PersonList(Resource): for x in data: arr.append(x.serialize()) session.close() + fr.initFaceRec() return flask.make_response(flask.jsonify({'data': arr}), 201) except Exception as e: diff --git a/application/face_rec.py b/application/face_rec.py index eeff553..31a8b4d 100644 --- a/application/face_rec.py +++ b/application/face_rec.py @@ -20,8 +20,6 @@ def initFaceRec(): dlib.DLIB_USE_CUDA=True print('Loading known faces...', dlib.DLIB_USE_CUDA) session = Session() - # We oranize known faces as subfolders of KNOWN_FACES_DIR - # Each subfolder's name becomes our label (name) for face, name in session.query(Person.face, Person.person_id).all(): # Load an image nparr = np.fromstring(base64.b64decode(face), np.uint8) @@ -41,7 +39,7 @@ def identifyFace(image): print('Identifying Face') nparr = np.fromstring(base64.b64decode(image), np.uint8) image = cv2.imdecode(nparr, cv2.IMREAD_COLOR) - #image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) + locations = face_recognition.face_locations(image, model=MODEL) encodings = face_recognition.face_encodings(image, locations) diff --git a/application/static/coms.js b/application/static/coms.js index 85c6b9f..fce1446 100644 --- a/application/static/coms.js +++ b/application/static/coms.js @@ -43,4 +43,17 @@ function postJSON(url, data, callback, fallback) { } }; xhr.send(data); +}; +function deleteJSON(url, callback, fallback) { + var xhr = new XMLHttpRequest(); + xhr.open('DELETE', url, false); + xhr.onload = function () { + var status = xhr.status; + if (status < 400) { + callback(null, xhr.response); + } else { + fallback(); + } + }; + xhr.send(); }; \ No newline at end of file diff --git a/application/static/main.css b/application/static/main.css index 9465eac..db82525 100644 --- a/application/static/main.css +++ b/application/static/main.css @@ -44,6 +44,7 @@ width: 9rem; margin:0; padding:0; + overflow: auto; } .card{ margin-top:1rem; @@ -76,7 +77,10 @@ width:100%; } - +.card-text{ + overflow: contain; + display: block; +} .heroInfo{ } @@ -94,6 +98,11 @@ padding:0; } #middle-right .listIMG{ - width: 10rem; + width: 15rem; float: left; +} + +.btn-delete{ + float: right; + margin-top: 5px; } \ No newline at end of file diff --git a/application/static/main.js b/application/static/main.js index 5d5a795..a7124e2 100644 --- a/application/static/main.js +++ b/application/static/main.js @@ -4,7 +4,7 @@ selected = null var ml = document.getElementById('middle-left'); var mr = document.getElementById('middle-right'); personData = {} - +state = null /** * Retrieves input data from a form and returns it as a JSON object. * @param {HTMLFormControlsCollection} elements the form elements @@ -25,7 +25,7 @@ function focusPerson(id) { selected = id; $("#person" + id).removeClass('border-light').siblings().addClass('border-light') $("#person" + id).addClass('border-success').siblings().removeClass('border-success') - renderPersonRight() + } function loadPersonList(data) { @@ -36,7 +36,7 @@ function loadPersonList(data) { string = `
-

${item["fname"]} ${item["lname"]}

+

${item["fname"]} ${item["lname"]}

${item["timestamp"]}

@@ -44,8 +44,7 @@ function loadPersonList(data) {

Gender: ${item["gender"]}
YoB: ${item["yob"]}
- Available FP: ${item["fingerprints"].length}
- +

@@ -76,10 +75,10 @@ function enrole(){ data = {"person": data} console.log(data) postJSON(rootKontext + "/api/v1/person/", JSON.stringify(data), - function(){ - location.reload() - }, - null + function(){ + location.reload() + }, + null ) } @@ -137,3 +136,10 @@ function loadData() { ); } +function deletePerson(id){ + deleteJSON(rootKontext + "/api/v1/person/"+id, + function(){ + location.reload() + }, + null) +} \ No newline at end of file diff --git a/test.sqlite b/test.sqlite index 99a9ad4..6bb29f9 100644 Binary files a/test.sqlite and b/test.sqlite differ