adjust for default path config

This commit is contained in:
Logan Garrett 2025-03-17 22:28:52 -04:00
parent aa1f1dfab8
commit 47f30528d8

View File

@ -177,16 +177,20 @@ def config(request: Request):
# Add model plus data if plus is enabled # Add model plus data if plus is enabled
if config["plus"]["enabled"]: if config["plus"]["enabled"]:
model_json_path = FilePath(config["model"]["path"]).with_suffix(".json") if "path" in config["model"]:
try: model_json_path = FilePath(config["model"]["path"]).with_suffix(".json")
with open(model_json_path, "r") as f: try:
model_plus_data = json.load(f) with open(model_json_path, "r") as f:
config["model"]["plus"] = model_plus_data model_plus_data = json.load(f)
except FileNotFoundError: config["model"]["plus"] = model_plus_data
config["model"]["plus"] = None except FileNotFoundError:
except json.JSONDecodeError: config["model"]["plus"] = None
except json.JSONDecodeError:
config["model"]["plus"] = None
else:
config["model"]["plus"] = None config["model"]["plus"] = None
# use merged labelamp # use merged labelamp
for detector_config in config["detectors"].values(): for detector_config in config["detectors"].values():
detector_config["model"]["labelmap"] = ( detector_config["model"]["labelmap"] = (