Fix file exist checks for plus:// paths

This commit is contained in:
Thomas Arthofer 2025-05-24 21:20:32 +02:00
parent 1762f3524a
commit 8327601c4b
2 changed files with 13 additions and 9 deletions

View File

@ -511,7 +511,8 @@ class FrigateConfig(FrigateBaseModel):
elif detector_config.type == "edgetpu": elif detector_config.type == "edgetpu":
model_config["path"] = "/edgetpu_model.tflite" model_config["path"] = "/edgetpu_model.tflite"
# Verify that the model path points to an existing file. # If using a local file, verify that the model path points to an existing file.
if not model_config["path"].startswith("plus://"):
if not os.path.exists(model_config["path"]): if not os.path.exists(model_config["path"]):
raise ValueError(f"Model path '{model_config['path']}' does not exist.") raise ValueError(f"Model path '{model_config['path']}' does not exist.")

View File

@ -103,14 +103,17 @@ class ModelConfig(BaseModel):
def __init__(self, **config): def __init__(self, **config):
super().__init__(**config) super().__init__(**config)
# Verify that the labelmap path points to an existing file. path = config.get("labelmap_path", "/labelmap.txt")
if not os.path.exists(config.get("labelmap_path", "/labelmap.txt")):
# If using a local file, verify that the labelmap path points to an existing file.
if not path.startswith("plus://"):
if not os.path.exists(path):
raise ValueError( raise ValueError(
f"Model labelmap_path '{config.get('labelmap_path', '/labelmap.txt')}' does not exist." f"Model labelmap_path '{path}' does not exist."
) )
self._merged_labelmap = { self._merged_labelmap = {
**load_labels(config.get("labelmap_path", "/labelmap.txt")), **load_labels(path),
**config.get("labelmap", {}), **config.get("labelmap", {}),
} }
self._colormap = {} self._colormap = {}