diff --git a/docling_serve/docling_conversion.py b/docling_serve/docling_conversion.py index 257b9f2..aee2c76 100644 --- a/docling_serve/docling_conversion.py +++ b/docling_serve/docling_conversion.py @@ -265,7 +265,7 @@ ConvertDocumentsRequest = Union[ # Document converters will be preloaded and stored in a dictionary -converters: Dict[str, DocumentConverter] = {} +converters: Dict[bytes, DocumentConverter] = {} # Custom serializer for PdfFormatOption @@ -301,7 +301,7 @@ def _serialize_pdf_format_option(pdf_format_option: PdfFormatOption) -> str: # Computes the PDF pipeline options and returns the PdfFormatOption and its hash def get_pdf_pipeline_opts( # noqa: C901 request: ConvertDocumentsOptions, -) -> Tuple[PdfFormatOption, str]: +) -> Tuple[PdfFormatOption, bytes]: if request.ocr_engine == OcrEngine.EASYOCR: try: import easyocr # noqa: F401 @@ -401,7 +401,7 @@ def get_pdf_pipeline_opts( # noqa: C901 serialized_data = _serialize_pdf_format_option(pdf_format_option) - options_hash = hashlib.sha1(serialized_data.encode()).hexdigest() + options_hash = hashlib.sha1(serialized_data.encode()).digest() return pdf_format_option, options_hash