From 57de8ad63a09b6ffa002d0be19b36cb45f153978 Mon Sep 17 00:00:00 2001 From: Christoph Auer Date: Mon, 14 Oct 2024 16:52:58 +0200 Subject: [PATCH] Fix generate_multimodal_pages Signed-off-by: Christoph Auer --- docling/utils/export.py | 4 ++-- examples/export_multimodal.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docling/utils/export.py b/docling/utils/export.py index d225b060..784723b7 100644 --- a/docling/utils/export.py +++ b/docling/utils/export.py @@ -1,8 +1,8 @@ import logging from typing import Any, Dict, Iterable, List, Tuple, Union -from docling_core.types.doc.base import BaseCell, BaseText, BoundingBox, Ref, Table -from docling_core.types.experimental import CoordOrigin +from docling_core.types.doc.base import BaseCell, BaseText, Ref, Table +from docling_core.types.experimental import BoundingBox, CoordOrigin from docling.datamodel.base_models import OcrCell from docling.datamodel.document import ConversionResult, Page diff --git a/examples/export_multimodal.py b/examples/export_multimodal.py index af569131..01477f00 100644 --- a/examples/export_multimodal.py +++ b/examples/export_multimodal.py @@ -9,6 +9,7 @@ from docling.datamodel.base_models import InputFormat from docling.datamodel.pipeline_options import PdfPipelineOptions from docling.document_converter import DocumentConverter, PdfFormatOption from docling.utils.export import generate_multimodal_pages +from docling.utils.utils import create_hash _log = logging.getLogger(__name__) @@ -56,7 +57,9 @@ def main(): { "document": conv_res.input.file.name, "hash": conv_res.input.document_hash, - "page_hash": page.page_hash, + "page_hash": create_hash( + conv_res.input.document_hash + ":" + str(page.page_no - 1) + ), "image": { "width": page.image.width, "height": page.image.height,