mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 20:58:11 +00:00
feat(ocr): added support for RapidOCR engine (#415)
* adding rapidocr engine for ocr in docling Signed-off-by: swayam-singhal <swayam.singhal@inito.com> * fixing styling format Signed-off-by: Swaymaw <swaymaw@gmail.com> * updating pyproject.toml and poetry.lock to fix ci bugs Signed-off-by: Swaymaw <swaymaw@gmail.com> * help poetry pinning for python3.9 Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> * simplifying rapidocr options so that device can be changed using a single option for all models Signed-off-by: Swaymaw <swaymaw@gmail.com> * fix styling issues and small bug in rapidOcrOptions Signed-off-by: Swaymaw <swaymaw@gmail.com> * use default device until we enable global management Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> --------- Signed-off-by: swayam-singhal <swayam.singhal@inito.com> Signed-off-by: Swaymaw <swaymaw@gmail.com> Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> Co-authored-by: swayam-singhal <swayam.singhal@inito.com> Co-authored-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
@@ -6,6 +6,7 @@ from docling.datamodel.pipeline_options import (
|
||||
EasyOcrOptions,
|
||||
OcrMacOptions,
|
||||
PdfPipelineOptions,
|
||||
RapidOcrOptions,
|
||||
TesseractCliOcrOptions,
|
||||
TesseractOcrOptions,
|
||||
)
|
||||
@@ -20,10 +21,11 @@ def main():
|
||||
pipeline_options.do_table_structure = True
|
||||
pipeline_options.table_structure_options.do_cell_matching = True
|
||||
|
||||
# Any of the OCR options can be used:EasyOcrOptions, TesseractOcrOptions, TesseractCliOcrOptions, OcrMacOptions(Mac only)
|
||||
# Any of the OCR options can be used:EasyOcrOptions, TesseractOcrOptions, TesseractCliOcrOptions, OcrMacOptions(Mac only), RapidOcrOptions
|
||||
# ocr_options = EasyOcrOptions(force_full_page_ocr=True)
|
||||
# ocr_options = TesseractOcrOptions(force_full_page_ocr=True)
|
||||
# ocr_options = OcrMacOptions(force_full_page_ocr=True)
|
||||
# ocr_options = RapidOcrOptions(force_full_page_ocr=True)
|
||||
ocr_options = TesseractCliOcrOptions(force_full_page_ocr=True)
|
||||
pipeline_options.ocr_options = ocr_options
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ Works on macOS, Linux, and Windows, with support for both x86_64 and arm64 archi
|
||||
| Tesseract | System dependency. See description for Tesseract and Tesserocr below. | `TesseractOcrOptions` |
|
||||
| Tesseract CLI | System dependency. See description below. | `TesseractCliOcrOptions` |
|
||||
| OcrMac | System dependency. See description below. | `OcrMacOptions` |
|
||||
| [RapidOCR](https://github.com/RapidAI/RapidOCR) | Extra feature not included in Default Docling installation can be installed via `pip install rapidocr_onnxruntime` | `RapidOcrOptions` |
|
||||
|
||||
The Docling `DocumentConverter` allows to choose the OCR engine with the `ocr_options` settings. For example
|
||||
|
||||
|
||||
Reference in New Issue
Block a user