mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-01 00:22:19 +03:00
Add ability to update Frigate+ model to latest from UI (#17324)
* Add ability to update Frigate+ model to latest
* UI tweaks
* further UI tweaks
* UI tweaks: add width and height, fix select
* Add placeholder while API call in progress
* Fix Frigate+ enabled check
* Fix config change lost when reloading page
* Add persistent message requiring restart
* Drop down supported detectors and dimensions
* Add width and height to display
* Update FrigatePlusSettingsView.tsx
* Temp fix for Codespaces not loading
* Add i18n, format
* remove unneeded brackets
* missing colon
* Revert "Temp fix for Codespaces not loading"
This reverts commit 75b19674ce.
This commit is contained in:
@@ -640,6 +640,48 @@ def get_sub_labels(split_joined: Optional[int] = None):
|
||||
return JSONResponse(content=sub_labels)
|
||||
|
||||
|
||||
@router.get("/plus/models")
|
||||
def plusModels(request: Request, filterByCurrentModelDetector: bool = False):
|
||||
if not request.app.frigate_config.plus_api.is_active():
|
||||
return JSONResponse(
|
||||
content=({"success": False, "message": "Frigate+ is not enabled"}),
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
models: dict[any, any] = request.app.frigate_config.plus_api.get_models()
|
||||
|
||||
if not models["list"]:
|
||||
return JSONResponse(
|
||||
content=({"success": False, "message": "No models found"}),
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
modelList = models["list"]
|
||||
|
||||
# current model type
|
||||
modelType = request.app.frigate_config.model.model_type
|
||||
|
||||
# current detectorType for comparing to supportedDetectors
|
||||
detectorType = list(request.app.frigate_config.detectors.values())[0].type
|
||||
|
||||
validModels = []
|
||||
|
||||
for model in sorted(
|
||||
filter(
|
||||
lambda m: (
|
||||
not filterByCurrentModelDetector
|
||||
or (detectorType in m["supportedDetectors"] and modelType in m["type"])
|
||||
),
|
||||
modelList,
|
||||
),
|
||||
key=(lambda m: m["trainDate"]),
|
||||
reverse=True,
|
||||
):
|
||||
validModels.append(model)
|
||||
|
||||
return JSONResponse(content=validModels)
|
||||
|
||||
|
||||
@router.get("/recognized_license_plates")
|
||||
def get_recognized_license_plates(split_joined: Optional[int] = None):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user