3 Commits

Author SHA1 Message Date
ishak jmilou.ishak
f493665275 riep de functie nergens aan 2025-01-21 16:13:26 +01:00
ishak jmilou.ishak
899aa94b40 seperate yolo results because it updates now only when going to /yolo_results 2025-01-21 16:01:59 +01:00
ishak jmilou.ishak
d5524d7890 shouldn't have done POST 2025-01-21 15:09:23 +01:00

View File

@@ -85,6 +85,7 @@ def index():
@app.route('/control', methods=["GET", "POST"])
def control():
if request.authorization and request.authorization.username == 'ishak' and request.authorization.password == 'kobuki':
yolo_results_db()
return render_template('control.html')
else:
return ('Unauthorized', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
@@ -158,9 +159,13 @@ def image():
return "No image available", 404
@app.route('/yolo_results', methods=['GET', 'POST'])
@app.route('/yolo_results', methods=['GET'])
def yolo_results_endpoint():
global yolo_results
global yolo_results
return jsonify(yolo_results)
def yolo_results_db():
global yolo_results
with lock:
try:
db = get_db()
@@ -175,8 +180,6 @@ def yolo_results_endpoint():
print(f"Database error: {err}")
except Exception as e:
print(f"Unexpected error: {e}")
return jsonify(yolo_results)
if __name__ == '__main__':
app.run(debug=True, port=5000)