mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-13 07:08:19 +00:00
Lots of import refactoring
Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
@@ -32,8 +32,16 @@ def export_documents(
|
||||
with (output_dir / f"{doc_filename}.json").open("w") as fp:
|
||||
fp.write(json.dumps(conv_res.render_as_dict()))
|
||||
|
||||
# Export Docling document format to JSON (experimental):
|
||||
with (output_dir / f"{doc_filename}.experimental.json").open("w") as fp:
|
||||
fp.write(
|
||||
json.dumps(
|
||||
conv_res.experimental.model_dump(mode="json", by_alias=True)
|
||||
)
|
||||
)
|
||||
|
||||
# Export Docling document format to YAML (experimental):
|
||||
with (output_dir / f"{doc_filename}.yaml").open("w") as fp:
|
||||
with (output_dir / f"{doc_filename}.experimental.yaml").open("w") as fp:
|
||||
fp.write(
|
||||
yaml.safe_dump(
|
||||
conv_res.experimental.model_dump(mode="json", by_alias=True)
|
||||
|
||||
@@ -8,7 +8,7 @@ from docling.datamodel.base_models import (
|
||||
ConversionStatus,
|
||||
FigureElement,
|
||||
PageElement,
|
||||
TableElement,
|
||||
Table,
|
||||
)
|
||||
from docling.datamodel.document import DocumentConversionInput
|
||||
from docling.document_converter import DocumentConverter
|
||||
@@ -61,7 +61,7 @@ def main():
|
||||
|
||||
# Export figures and tables
|
||||
for element, image in conv_res.render_element_images(
|
||||
element_types=(FigureElement, TableElement)
|
||||
element_types=(FigureElement, Table)
|
||||
):
|
||||
element_image_filename = (
|
||||
output_dir / f"{doc_filename}-element-{element.id}.png"
|
||||
|
||||
Reference in New Issue
Block a user