mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-05 12:54:57 +00:00
Compare commits
3 Commits
976840c6b2
...
f493665275
Author | SHA1 | Date | |
---|---|---|---|
|
f493665275 | ||
|
899aa94b40 | ||
|
d5524d7890 |
@@ -85,6 +85,7 @@ def index():
|
|||||||
@app.route('/control', methods=["GET", "POST"])
|
@app.route('/control', methods=["GET", "POST"])
|
||||||
def control():
|
def control():
|
||||||
if request.authorization and request.authorization.username == 'ishak' and request.authorization.password == 'kobuki':
|
if request.authorization and request.authorization.username == 'ishak' and request.authorization.password == 'kobuki':
|
||||||
|
yolo_results_db()
|
||||||
return render_template('control.html')
|
return render_template('control.html')
|
||||||
else:
|
else:
|
||||||
return ('Unauthorized', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
|
return ('Unauthorized', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
|
||||||
@@ -158,9 +159,13 @@ def image():
|
|||||||
return "No image available", 404
|
return "No image available", 404
|
||||||
|
|
||||||
|
|
||||||
@app.route('/yolo_results', methods=['GET', 'POST'])
|
@app.route('/yolo_results', methods=['GET'])
|
||||||
def yolo_results_endpoint():
|
def yolo_results_endpoint():
|
||||||
global yolo_results
|
global yolo_results
|
||||||
|
return jsonify(yolo_results)
|
||||||
|
|
||||||
|
def yolo_results_db():
|
||||||
|
global yolo_results
|
||||||
with lock:
|
with lock:
|
||||||
try:
|
try:
|
||||||
db = get_db()
|
db = get_db()
|
||||||
@@ -175,8 +180,6 @@ def yolo_results_endpoint():
|
|||||||
print(f"Database error: {err}")
|
print(f"Database error: {err}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Unexpected error: {e}")
|
print(f"Unexpected error: {e}")
|
||||||
|
|
||||||
return jsonify(yolo_results)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True, port=5000)
|
app.run(debug=True, port=5000)
|
Reference in New Issue
Block a user