()
| 51 | |
| 52 | |
| 53 | def _ensure_model_loaded() -> None: |
| 54 | global _model, _model_load_attempted |
| 55 | if _model_load_attempted: |
| 56 | return |
| 57 | _model_load_attempted = True |
| 58 | online = _get_online_model_path() |
| 59 | default = Path(__file__).parent / "model.json" |
| 60 | if online.exists(): |
| 61 | _model = ScriptAgnosticClassifier() |
| 62 | _model.load(online) |
| 63 | elif default.exists(): |
| 64 | _model = ScriptAgnosticClassifier() |
| 65 | _model.load(default) |
| 66 | |
| 67 | |
| 68 | def load_learned_model(path: str | None = None) -> None: |