mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-28 10:56:52 +03:00
Implement UI for managing multiple models (#24023)
* Implement hardware detection and UI management * Cleanup Frigate+ detection * Don't count model as changed * Fixes for audio map error * Add descriptions * Enforce that all model must exist * Fix hardware picking * Docs fixes * WebUI cleanup * Cleanup handling of scenes * UI refinement * Cleanup recommended UI * test fixews
This commit is contained in:
+11
-1
@@ -1330,8 +1330,18 @@ def categorized_object_names(
|
||||
|
||||
|
||||
@router.get("/audio_labels", dependencies=[Depends(allow_any_authenticated())])
|
||||
def get_audio_labels():
|
||||
def get_audio_labels(request: Request):
|
||||
labels = load_labels("/audio-labelmap.txt", prefill=521)
|
||||
|
||||
# configured overrides group several audio classes under one label, and the
|
||||
# detector merges them over the defaults at runtime. Offer them here too, or
|
||||
# a grouped label could never be picked in the UI.
|
||||
config: FrigateConfig = request.app.frigate_config
|
||||
labels.update(config.audio.labelmap)
|
||||
|
||||
for camera in config.cameras.values():
|
||||
labels.update(camera.audio.labelmap)
|
||||
|
||||
return JSONResponse(content=labels)
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ class Tags(Enum):
|
||||
chat = "Chat"
|
||||
events = "Events"
|
||||
export = "Export"
|
||||
hardware = "Hardware"
|
||||
classification = "Classification"
|
||||
logs = "Logs"
|
||||
media = "Media"
|
||||
|
||||
@@ -21,6 +21,7 @@ from frigate.api import (
|
||||
debug_replay,
|
||||
event,
|
||||
export,
|
||||
hardware,
|
||||
media,
|
||||
motion_search,
|
||||
notification,
|
||||
@@ -145,6 +146,7 @@ def create_fastapi_app(
|
||||
app.include_router(preview.router)
|
||||
app.include_router(notification.router)
|
||||
app.include_router(export.router)
|
||||
app.include_router(hardware.router)
|
||||
app.include_router(event.router)
|
||||
app.include_router(media.router)
|
||||
app.include_router(motion_search.router)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
"""Hardware discovery APIs."""
|
||||
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from frigate.api.auth import require_role
|
||||
from frigate.api.defs.tags import Tags
|
||||
from frigate.detectors.hardware import DetectionHardware, hardware_prober
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter(tags=[Tags.hardware])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/hardware/probe",
|
||||
response_model=list[DetectionHardware],
|
||||
dependencies=[Depends(require_role(["admin"]))],
|
||||
)
|
||||
def probe_hardware(refresh: bool = False) -> list[DetectionHardware]:
|
||||
"""Get the object detection hardware attached to this system.
|
||||
|
||||
Args:
|
||||
refresh: Probe again instead of returning the cached result
|
||||
|
||||
Returns:
|
||||
Every kind of detection hardware that was found
|
||||
"""
|
||||
return hardware_prober.probe(refresh=refresh)
|
||||
Reference in New Issue
Block a user