Harden AI Docker runtime imports
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-07-05 00:40:08 +02:00
parent 8b09bee84a
commit 7dcce9c2b8
9 changed files with 53 additions and 5 deletions
+6 -2
View File
@@ -1,6 +1,5 @@
from __future__ import annotations
import importlib.util
from pathlib import Path
from typing import Any
@@ -14,7 +13,12 @@ class YoloDetectionAdapter:
@staticmethod
def dependencies_available() -> bool:
return importlib.util.find_spec("ultralytics") is not None and importlib.util.find_spec("torch") is not None
try:
import torch # noqa: F401
import ultralytics # noqa: F401
except Exception:
return False
return True
def load_model(self, model_path: Path):
if not model_path.exists() or not model_path.is_file():