mirror of
https://github.com/docling-project/docling-serve.git
synced 2025-11-29 08:33:50 +00:00
fix: allow users to set the area threshold for picture descriptions (#165)
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> Signed-off-by: Michele Dolfi <97102151+dolfim-ibm@users.noreply.github.com> Co-authored-by: Cesar Berrospi Ramis <75900930+ceberam@users.noreply.github.com>
This commit is contained in:
@@ -9,6 +9,7 @@ from docling.datamodel.pipeline_options import (
|
||||
EasyOcrOptions,
|
||||
PdfBackend,
|
||||
PdfPipeline,
|
||||
PictureDescriptionBaseOptions,
|
||||
TableFormerMode,
|
||||
TableStructureOptions,
|
||||
)
|
||||
@@ -339,6 +340,14 @@ class ConvertDocumentsOptions(BaseModel):
|
||||
),
|
||||
] = False
|
||||
|
||||
picture_description_area_threshold: Annotated[
|
||||
float,
|
||||
Field(
|
||||
description="Minimum percentage of the area for a picture to be processed with the models.",
|
||||
examples=[PictureDescriptionBaseOptions().picture_area_threshold],
|
||||
),
|
||||
] = PictureDescriptionBaseOptions().picture_area_threshold
|
||||
|
||||
picture_description_local: Annotated[
|
||||
Optional[PictureDescriptionLocal],
|
||||
Field(
|
||||
|
||||
@@ -150,6 +150,9 @@ def _parse_standard_pdf_opts(
|
||||
request.picture_description_api.model_dump()
|
||||
)
|
||||
)
|
||||
pipeline_options.picture_description_options.picture_area_threshold = (
|
||||
request.picture_description_area_threshold
|
||||
)
|
||||
|
||||
return pipeline_options
|
||||
|
||||
|
||||
Reference in New Issue
Block a user