Plantages signalés sous Windows : causes identifiées et corrigées.
1. anonymisation_onefile.spec : les fichiers data/stopwords_manuels.txt,
villes_blacklist.txt, dpi_labels_blacklist.txt, companion_blacklist.txt
n'étaient PAS inclus dans le bundle PyInstaller (seuls les sous-dossiers
data/bdpm, data/finess, data/insee l'étaient). Résultat en frozen : sets
vides, qualité dégradée, plus de faux positifs.
2. anonymizer_core_refactored_onnx.py : chargements robustifiés.
- Helper _load_txt_set avec try/except et logging WARNING si fichier absent
- Fallbacks intégrés (_DPI_LABELS_FALLBACK, _COMPANION_BLACKLIST_FALLBACK)
pour continuer à fonctionner si bundle partiel
- try/except sur stopwords_manuels.txt, villes_blacklist.txt, BDPM
3. launcher.py : UX repensée pour le chargement des modèles.
- SetupWindow (premier lancement) : auto-démarrage (plus de clic nécessaire),
progress bar avec étapes visuelles (⏳/✓/✗ par modèle), bouton relance si
échec, bouton "continuer malgré tout" pour modèles optionnels.
- Splash screen ajouté dans launch_gui() : le chargement des gazetteers
(INSEE 200k+ noms, FINESS 100k+ établissements) prend 15-30 s au démarrage
normal. Sans feedback, l'utilisateur croyait l'app plantée. Le splash
tourne pendant l'import (thread séparé, poll avec splash.after).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
57 lines
2.2 KiB
Python
57 lines
2.2 KiB
Python
import os
|
|
block_cipher = None
|
|
app_dir = 'C:\\Users\\dom\\ai\\anonymisation'
|
|
|
|
datas = [
|
|
(os.path.join(app_dir, 'config'), 'config'),
|
|
(os.path.join(app_dir, 'data', 'bdpm'), os.path.join('data', 'bdpm')),
|
|
(os.path.join(app_dir, 'data', 'finess'), os.path.join('data', 'finess')),
|
|
(os.path.join(app_dir, 'data', 'insee'), os.path.join('data', 'insee')),
|
|
(os.path.join(app_dir, 'models', 'camembert-bio-deid', 'onnx'), os.path.join('models', 'camembert-bio-deid', 'onnx')),
|
|
(os.path.join(app_dir, 'detectors'), 'detectors'),
|
|
(os.path.join(app_dir, 'scripts'), 'scripts'),
|
|
]
|
|
# Fichiers directs dans data/ — IMPÉRATIF pour fonctionnement correct du core.
|
|
# Sans eux : stop-words/villes/DPI labels/companion blacklist sont des sets vides,
|
|
# ce qui dégrade la qualité d'anonymisation et peut masquer/laisser passer des faux-positifs.
|
|
for data_file in [
|
|
'stopwords_manuels.txt',
|
|
'villes_blacklist.txt',
|
|
'dpi_labels_blacklist.txt',
|
|
'companion_blacklist.txt',
|
|
]:
|
|
src = os.path.join(app_dir, 'data', data_file)
|
|
if os.path.exists(src):
|
|
datas.append((src, 'data'))
|
|
for pyfile in ['anonymizer_core_refactored_onnx.py', 'eds_pseudo_manager.py',
|
|
'gliner_manager.py', 'camembert_ner_manager.py',
|
|
'Pseudonymisation_Gui_V5.py']:
|
|
datas.append((os.path.join(app_dir, pyfile), '.'))
|
|
|
|
a = Analysis(
|
|
[os.path.join(app_dir, 'launcher.py')],
|
|
pathex=[app_dir],
|
|
datas=datas,
|
|
hiddenimports=[
|
|
'anonymizer_core_refactored_onnx', 'eds_pseudo_manager',
|
|
'gliner_manager', 'camembert_ner_manager', 'Pseudonymisation_Gui_V5',
|
|
'edsnlp', 'edsnlp.pipes', 'edsnlp.pipes.ner', 'edsnlp.pipes.ner.pseudo',
|
|
'spacy', 'spacy.lang.fr', 'gliner', 'onnxruntime',
|
|
'transformers', 'tokenizers', 'torch', 'pdfplumber',
|
|
'ahocorasick', 'sklearn', 'scipy', 'pydantic', 'yaml', 'PIL',
|
|
'loguru', 'regex',
|
|
],
|
|
cipher=block_cipher,
|
|
noarchive=False,
|
|
)
|
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
|
exe = EXE(
|
|
pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [],
|
|
name='Anonymisation',
|
|
debug=False,
|
|
strip=False,
|
|
upx=False,
|
|
console=False,
|
|
icon=None,
|
|
)
|