Config options for generating page images
This commit is contained in:
parent
2930679dc1
commit
447e94c5db
4 changed files with 9 additions and 1 deletions
|
|
@ -125,6 +125,7 @@ class ConversionOptions(BaseModel):
|
|||
|
||||
# Image options
|
||||
images_scale: float = 2.0
|
||||
generate_page_images: bool = True
|
||||
generate_picture_images: bool = False
|
||||
|
||||
# VLM picture description
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class DoclingLocalConverter(DocumentConverter):
|
|||
do_ocr=opts.do_ocr,
|
||||
do_table_structure=opts.do_table_structure,
|
||||
images_scale=opts.images_scale,
|
||||
generate_page_images=True,
|
||||
generate_page_images=opts.generate_page_images,
|
||||
generate_picture_images=opts.generate_picture_images or pic_desc.enabled,
|
||||
table_structure_options=TableStructureOptions(
|
||||
do_cell_matching=opts.table_cell_matching,
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ class DoclingServeConverter(DocumentConverter):
|
|||
"table_mode": opts.table_mode,
|
||||
"table_cell_matching": str(opts.table_cell_matching).lower(),
|
||||
"images_scale": str(opts.images_scale),
|
||||
"generate_page_images": str(opts.generate_page_images).lower(),
|
||||
"generate_picture_images": str(
|
||||
opts.generate_picture_images or pic_desc.enabled
|
||||
).lower(),
|
||||
|
|
|
|||
|
|
@ -304,11 +304,15 @@ class TestDoclingLocalConverter:
|
|||
config.processing.conversion_options.do_ocr = False
|
||||
config.processing.conversion_options.table_mode = "fast"
|
||||
config.processing.conversion_options.images_scale = 3.0
|
||||
config.processing.conversion_options.generate_page_images = False
|
||||
converter = DoclingLocalConverter(config)
|
||||
|
||||
assert converter.config.processing.conversion_options.do_ocr is False
|
||||
assert converter.config.processing.conversion_options.table_mode == "fast"
|
||||
assert converter.config.processing.conversion_options.images_scale == 3.0
|
||||
assert (
|
||||
converter.config.processing.conversion_options.generate_page_images is False
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_convert_pdf_without_picture_images(self, config):
|
||||
|
|
@ -542,6 +546,7 @@ class TestDoclingServeConverter:
|
|||
config.processing.conversion_options.table_cell_matching = False
|
||||
config.processing.conversion_options.do_table_structure = False
|
||||
config.processing.conversion_options.images_scale = 3.0
|
||||
config.processing.conversion_options.generate_page_images = False
|
||||
converter = DoclingServeConverter(config)
|
||||
|
||||
doc_json = create_mock_docling_document("test")
|
||||
|
|
@ -567,6 +572,7 @@ class TestDoclingServeConverter:
|
|||
assert data["table_cell_matching"] == "false"
|
||||
assert data["do_table_structure"] == "false"
|
||||
assert data["images_scale"] == "3.0"
|
||||
assert data["generate_page_images"] == "false"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_convert_text_connection_error(self, converter):
|
||||
|
|
|
|||
Loading…
Reference in a new issue