Add endpoint to get list of sub labels inside DB

This commit is contained in:
Nick Mowen 2022-05-05 21:21:08 -06:00
parent 970e6b0174
commit 103073b587

View File

@ -11,6 +11,7 @@ import subprocess as sp
import time
from functools import reduce
from pathlib import Path
from certifi import where
import cv2
from flask.helpers import send_file
@ -586,6 +587,20 @@ def mjpeg_feed(camera_name):
return "Camera named {} not found".format(camera_name), 404
@bp.route("/sub_labels")
def get_sub_labels():
try:
sub_labels = Event.select(
Event.sub_label,
).where(Event.sub_label != None)
except:
return jsonify(
{"success": False, "message": "Failed to get sub_labels"}, "404"
)
return jsonify(sub_labels)
@bp.route("/<camera_name>/latest.jpg")
def latest_frame(camera_name):
draw_options = {