Fix datamodel usage for Figure

Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
Christoph Auer 2024-09-10 14:51:29 +02:00
parent c308d7e87a
commit fd23432f6e
2 changed files with 6 additions and 5 deletions

View File

@ -11,6 +11,7 @@ from docling_core.types import FileInfoObject as DsFileInfoObject
from docling_core.types import PageDimensions, PageReference, Prov, Ref
from docling_core.types import Table as DsSchemaTable
from docling_core.types import TableCell
from docling_core.types.doc.base import Figure
from pydantic import BaseModel
from typing_extensions import deprecated
@ -279,7 +280,7 @@ class ConvertedDocument(BaseModel):
),
)
figures.append(
BaseCell(
Figure(
prov=[
Prov(
bbox=target_bbox,
@ -344,7 +345,7 @@ class ConvertedDocument(BaseModel):
"subtitle-level-1",
"paragraph",
"caption",
]
],
):
return self.output.export_to_markdown(
delim=delim,

View File

@ -37,11 +37,11 @@ def export_documents(
# Export Markdown format:
with (output_dir / f"{doc_filename}.md").open("w") as fp:
fp.write(conv_res.render_as_markdown())
# Export Document Tags format:
with (output_dir / f"{doc_filename}.doctags").open("w") as fp:
fp.write(conv_res.render_as_doctags())
fp.write(conv_res.render_as_doctags())
elif conv_res.status == ConversionStatus.PARTIAL_SUCCESS:
_log.info(
f"Document {conv_res.input.file} was partially converted with the following errors:"