47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Test rapide pour vérifier que le GUI peut anonymiser correctement."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
|
|
import anonymizer_core_refactored_onnx as core
|
|
|
|
# Test avec un PDF simple
|
|
test_pdf = Path("/tmp/test_gui_pdfs")
|
|
if not test_pdf.exists():
|
|
print("❌ Répertoire de test non trouvé:", test_pdf)
|
|
sys.exit(1)
|
|
|
|
pdfs = list(test_pdf.glob("*.pdf"))
|
|
if not pdfs:
|
|
print("❌ Aucun PDF trouvé dans:", test_pdf)
|
|
sys.exit(1)
|
|
|
|
pdf = pdfs[0]
|
|
print(f"Test avec: {pdf}")
|
|
|
|
out_dir = Path("/tmp/test_gui_fixed")
|
|
out_dir.mkdir(exist_ok=True)
|
|
|
|
try:
|
|
# Simuler l'appel du GUI (sans use_vlm)
|
|
outputs = core.process_pdf(
|
|
pdf_path=pdf,
|
|
out_dir=out_dir,
|
|
make_vector_redaction=False,
|
|
also_make_raster_burn=True,
|
|
config_path=Path("config/dictionnaires.yml"),
|
|
use_hf=False,
|
|
ner_manager=None,
|
|
ner_thresholds=None,
|
|
ogc_label=None,
|
|
vlm_manager=None,
|
|
)
|
|
print(f"✅ Succès: {outputs}")
|
|
except Exception as e:
|
|
print(f"❌ Erreur: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
sys.exit(1)
|