Embarquer modèle NER + chargement auto au démarrage

- GUI V5 : charge DistilCamemBERT-NER automatiquement en arrière-plan
- _app_dir() : chemin compatible Nuitka onefile
- Build Nuitka : inclut models/ + config/ dans le .exe
- GitHub Actions : étape download model avant compilation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 15:31:17 +01:00
parent 8339069c83
commit 2e7e31a1f9
3 changed files with 50 additions and 15 deletions

View File

@@ -13,6 +13,7 @@ REM ============================================================
setlocal
set APP_NAME=Pseudonymisation
set ENTRY=Pseudonymisation_Gui_V5.py
set MODEL_ID=cmarkea/distilcamembert-base-ner
echo [build] Verification de Python...
python --version || (echo Python introuvable & exit /b 1)
@@ -20,7 +21,10 @@ python --version || (echo Python introuvable & exit /b 1)
echo [build] Installation de Nuitka si absent...
pip install nuitka orderedset zstandard 2>nul
echo [build] Compilation avec Nuitka (cela peut prendre 5-15 min)...
echo [build] Telechargement du modele NER si absent...
python -c "from ner_manager_onnx import NerModelManager; m=NerModelManager(cache_dir='models'); m.load('%MODEL_ID%'); print('Modele OK'); m.unload()"
echo [build] Compilation avec Nuitka (cela peut prendre 10-20 min)...
python -m nuitka ^
--standalone ^
--onefile ^
@@ -29,6 +33,7 @@ python -m nuitka ^
--include-module=ner_manager_onnx ^
--include-module=eds_pseudo_manager ^
--include-data-dir=config=config ^
--include-data-dir=models=models ^
--windows-console-mode=disable ^
--output-filename=%APP_NAME%.exe ^
--company-name="Hopital" ^
@@ -45,5 +50,5 @@ if %ERRORLEVEL% NEQ 0 (
)
echo [build] OK — Executable cree : %APP_NAME%.exe
echo [build] Copiez %APP_NAME%.exe + le dossier config/ sur la machine cible.
echo [build] Le modele NER est embarque. Aucun telechargement necessaire.
endlocal