feat(cli): charger les moteurs optionnels depuis les modeles embarques
This commit is contained in:
@@ -73,6 +73,14 @@ def _camembert_model_path() -> Path:
|
||||
return _app_dir() / "models" / "camembert-bio-deid" / "onnx" / "model.onnx"
|
||||
|
||||
|
||||
def _eds_model_path() -> Path:
|
||||
return _app_dir() / "models" / "eds-pseudo-public"
|
||||
|
||||
|
||||
def _gliner_model_path() -> Path:
|
||||
return _app_dir() / "models" / "gliner_multi_pii-v1"
|
||||
|
||||
|
||||
def _probe_camembert() -> "tuple[bool, str]":
|
||||
if not _has_module("onnxruntime"):
|
||||
return False, "onnxruntime non embarqué dans cette version"
|
||||
@@ -85,13 +93,17 @@ def _probe_eds() -> "tuple[bool, str]":
|
||||
missing = [m for m in ("edsnlp", "spacy") if not _has_module(m)]
|
||||
if missing:
|
||||
return False, "non embarqué dans cette version (manque : " + ", ".join(missing) + ")"
|
||||
return True, "edsnlp + spacy disponibles"
|
||||
if not _eds_model_path().is_dir():
|
||||
return False, "dépendances disponibles, modèle AP-HP eds-pseudo-public non embarqué"
|
||||
return True, "edsnlp + spacy + modèle AP-HP embarqués"
|
||||
|
||||
|
||||
def _probe_gliner() -> "tuple[bool, str]":
|
||||
if not _has_module("gliner"):
|
||||
return False, "non embarqué dans cette version (manque : gliner)"
|
||||
return True, "gliner disponible"
|
||||
if not _gliner_model_path().is_dir():
|
||||
return False, "dépendance disponible, modèle GLiNER non embarqué"
|
||||
return True, "gliner + modèle local embarqués"
|
||||
|
||||
|
||||
def _default_probes() -> Dict[str, Probe]:
|
||||
|
||||
Reference in New Issue
Block a user