mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-30 14:04:27 +00:00
add factory return and ignore options type
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
parent
b2021ac8d8
commit
fdaa53a618
@ -410,7 +410,7 @@ def convert(
|
||||
export_doctags = OutputFormat.DOCTAGS in to_formats
|
||||
|
||||
ocr_factory = get_ocr_factory(allow_external_plugins=allow_external_plugins)
|
||||
ocr_options: OcrOptions = ocr_factory.create_options(
|
||||
ocr_options: OcrOptions = ocr_factory.create_options( # type: ignore
|
||||
kind=ocr_engine,
|
||||
force_full_page_ocr=force_ocr,
|
||||
)
|
||||
|
@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@lru_cache()
|
||||
def get_ocr_factory(allow_external_plugins: bool = False):
|
||||
def get_ocr_factory(allow_external_plugins: bool = False) -> OcrFactory:
|
||||
factory = OcrFactory()
|
||||
factory.load_from_plugins(allow_external_plugins=allow_external_plugins)
|
||||
logger.info("Registered ocr engines: %r", factory.registered_kind)
|
||||
@ -18,7 +18,9 @@ def get_ocr_factory(allow_external_plugins: bool = False):
|
||||
|
||||
|
||||
@lru_cache()
|
||||
def get_picture_description_factory(allow_external_plugins: bool = False):
|
||||
def get_picture_description_factory(
|
||||
allow_external_plugins: bool = False,
|
||||
) -> PictureDescriptionFactory:
|
||||
factory = PictureDescriptionFactory()
|
||||
factory.load_from_plugins(allow_external_plugins=allow_external_plugins)
|
||||
logger.info("Registered picture descriptions: %r", factory.registered_kind)
|
||||
|
Loading…
Reference in New Issue
Block a user