mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 11:55:00 +00:00
returned to ohter function
This commit is contained in:
@@ -163,17 +163,25 @@ def image():
|
|||||||
def yolo_results_endpoint():
|
def yolo_results_endpoint():
|
||||||
global yolo_results
|
global yolo_results
|
||||||
with lock:
|
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()
|
||||||
return jsonify(yolo_results)
|
return jsonify(yolo_results)
|
||||||
|
|
||||||
def yolo_results_db():
|
# def yolo_results_db():
|
||||||
global yolo_results
|
# global yolo_results
|
||||||
db = get_db()
|
# with lock:
|
||||||
with db.cursor() as cursor:
|
# db = get_db()
|
||||||
sql_yolo = "INSERT INTO image (object, confidence) VALUES (%s, %s)"
|
# with db.cursor() as cursor:
|
||||||
yolo_tuples = [(result["class"], result["confidence"]) for result in yolo_results]
|
# sql_yolo = "INSERT INTO image (object, confidence) VALUES (%s, %s)"
|
||||||
cursor.executemany(sql_yolo, yolo_tuples)
|
# yolo_tuples = [(result["class"], result["confidence"]) for result in yolo_results]
|
||||||
db.commit()
|
# cursor.executemany(sql_yolo, yolo_tuples)
|
||||||
cursor.close()
|
# db.commit()
|
||||||
|
# cursor.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user