Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions docling/models/stages/ocr/auto_ocr_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,27 +95,6 @@ def __init__(
except ImportError:
_log.info("easyocr cannot be used because it is not installed.")

if self._engine is None:
try:
import torch
from rapidocr import EngineType, RapidOCR # type: ignore

self._engine = RapidOcrModel(
enabled=self.enabled,
artifacts_path=artifacts_path,
options=RapidOcrOptions(
backend="torch",
bitmap_area_threshold=self.options.bitmap_area_threshold,
force_full_page_ocr=self.options.force_full_page_ocr,
),
accelerator_options=accelerator_options,
)
_log.info("Auto OCR model selected rapidocr with torch.")
except ImportError:
_log.info(
"rapidocr cannot be used because rapidocr or torch is not installed."
)

if self._engine is None:
_log.warning("No OCR engine found. Please review the install details.")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ cli = [
# CONVENIENCE BUNDLES
# ============================================================================
standard = [
'docling-slim[format-pdf,models-local,feat-ocr-rapidocr,format-office,format-web,format-latex,format-email,feat-chunking,extract-core,service-client,cli]',
'docling-slim[format-pdf,models-local,feat-ocr-rapidocr-onnx,format-office,format-web,format-latex,format-email,feat-chunking,extract-core,service-client,cli]',
]

all = [
Expand Down
7 changes: 7 additions & 0 deletions tests/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ def test_kserve_v2_binary_data_deprecated_alias():
assert options.use_binary_data is True


def test_standard_extra_installs_rapidocr_onnx():
pyproject = Path("pyproject.toml").read_text()

assert "feat-ocr-rapidocr-onnx" in pyproject
assert "models-local,feat-ocr-rapidocr," not in pyproject


def test_e2e_conversions(test_doc_path):
for converter in get_converters_with_table_options():
print(f"converting {test_doc_path}")
Expand Down
5 changes: 3 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading