mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-26 20:14:47 +00:00
Fix datamodel usage for Figure
Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
parent
c308d7e87a
commit
fd23432f6e
@ -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 PageDimensions, PageReference, Prov, Ref
|
||||||
from docling_core.types import Table as DsSchemaTable
|
from docling_core.types import Table as DsSchemaTable
|
||||||
from docling_core.types import TableCell
|
from docling_core.types import TableCell
|
||||||
|
from docling_core.types.doc.base import Figure
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from typing_extensions import deprecated
|
from typing_extensions import deprecated
|
||||||
|
|
||||||
@ -279,7 +280,7 @@ class ConvertedDocument(BaseModel):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
figures.append(
|
figures.append(
|
||||||
BaseCell(
|
Figure(
|
||||||
prov=[
|
prov=[
|
||||||
Prov(
|
Prov(
|
||||||
bbox=target_bbox,
|
bbox=target_bbox,
|
||||||
@ -344,7 +345,7 @@ class ConvertedDocument(BaseModel):
|
|||||||
"subtitle-level-1",
|
"subtitle-level-1",
|
||||||
"paragraph",
|
"paragraph",
|
||||||
"caption",
|
"caption",
|
||||||
]
|
],
|
||||||
):
|
):
|
||||||
return self.output.export_to_markdown(
|
return self.output.export_to_markdown(
|
||||||
delim=delim,
|
delim=delim,
|
||||||
|
@ -37,11 +37,11 @@ def export_documents(
|
|||||||
# Export Markdown format:
|
# Export Markdown format:
|
||||||
with (output_dir / f"{doc_filename}.md").open("w") as fp:
|
with (output_dir / f"{doc_filename}.md").open("w") as fp:
|
||||||
fp.write(conv_res.render_as_markdown())
|
fp.write(conv_res.render_as_markdown())
|
||||||
|
|
||||||
# Export Document Tags format:
|
# Export Document Tags format:
|
||||||
with (output_dir / f"{doc_filename}.doctags").open("w") as fp:
|
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:
|
elif conv_res.status == ConversionStatus.PARTIAL_SUCCESS:
|
||||||
_log.info(
|
_log.info(
|
||||||
f"Document {conv_res.input.file} was partially converted with the following errors:"
|
f"Document {conv_res.input.file} was partially converted with the following errors:"
|
||||||
|
Loading…
Reference in New Issue
Block a user