removed commented code

This commit is contained in:
ishak jmilou.ishak
2025-01-16 12:15:14 +01:00
parent 7b51330675
commit 36aaee9bad

View File

@@ -48,7 +48,6 @@ def on_message(client, userdata, message):
x1, y1, x2, y2 = map(int, box.xyxy[0]) x1, y1, x2, y2 = map(int, box.xyxy[0])
cv2.rectangle(processed_image, (x1, y1), (x2, y2), (0, 255, 0), 2) cv2.rectangle(processed_image, (x1, y1), (x2, y2), (0, 255, 0), 2)
cv2.putText(processed_image, f"{class_name} {box.conf.item():.2f}", (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2) cv2.putText(processed_image, f"{class_name} {box.conf.item():.2f}", (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)
# yolo_results_db()
# Create an MQTT client instance # Create an MQTT client instance
mqtt_client = mqtt.Client() mqtt_client = mqtt.Client()
@@ -163,7 +162,6 @@ def image():
def yolo_results_endpoint(): def yolo_results_endpoint():
global yolo_results global yolo_results
with lock: with lock:
print(f"YOLO Results: {yolo_results}") # Debug statement
db = get_db() db = get_db()
with db.cursor() as cursor: with db.cursor() as cursor:
sql_yolo = "INSERT INTO image (class, confidence) VALUES (%s, %s)" sql_yolo = "INSERT INTO image (class, confidence) VALUES (%s, %s)"
@@ -174,17 +172,6 @@ def yolo_results_endpoint():
cursor.close() cursor.close()
return jsonify(yolo_results) return jsonify(yolo_results)
# def yolo_results_db():
# global yolo_results
# with lock:
# db = get_db()
# with db.cursor() as cursor:
# sql_yolo = "INSERT INTO image (object, confidence) VALUES (%s, %s)"
# yolo_tuples = [(result["class"], result["confidence"]) for result in yolo_results]
# cursor.executemany(sql_yolo, yolo_tuples)
# db.commit()
# cursor.close()
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True, port=5000) app.run(debug=True, port=5000)