23 lines
666 B
Python
23 lines
666 B
Python
"""LegacyHUB adapter for the shared document recognition engine."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from teamhub_document_recognition_engine import OcrResult
|
|
from teamhub_document_recognition_engine import run_ocr as _engine_run_ocr
|
|
|
|
from app.config import settings
|
|
|
|
|
|
def run_ocr(input_pdf: Path, output_pdf: Path, languages: str | None = None) -> OcrResult:
|
|
return _engine_run_ocr(
|
|
input_pdf,
|
|
output_pdf,
|
|
languages=languages or settings.ocr_languages,
|
|
enabled=settings.ocr_enabled,
|
|
deskew=settings.ocr_deskew,
|
|
clean=settings.ocr_clean,
|
|
optimize=settings.ocr_optimize,
|
|
)
|