Read-only mirror of https://github.com/DCC-BS/docling-pp-ocrv6 — Basel-Stadt. Issues & pull requests at the source.
  • Python 95.2%
  • Makefile 4.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-30 14:30:30 +02:00
.agent/rules Initial 2026-06-29 09:49:29 +02:00
.github/workflows Add files via upload 2026-06-30 14:30:30 +02:00
src/docling_pp_ocrv6 Reduce comments 2026-06-29 10:07:23 +02:00
tests Initial 2026-06-29 09:57:27 +02:00
.gitignore Initial 2026-06-29 09:49:29 +02:00
.pre-commit-config.yaml Initial 2026-06-29 09:49:29 +02:00
.python-version Initial 2026-06-29 09:49:29 +02:00
codecov.yml Initial 2026-06-29 09:49:29 +02:00
LICENSE Initial 2026-06-29 09:49:29 +02:00
Makefile Initial 2026-06-29 09:49:29 +02:00
pyproject.toml Fix CI 2026-06-29 12:05:19 +02:00
README.md Improve readme 2026-06-29 11:22:51 +02:00
renovate.json Initial 2026-06-29 09:49:29 +02:00
uv.lock Fix CI 2026-06-29 12:05:19 +02:00

docling-pp-ocrv6

A Docling OCR plugin for PaddlePaddle's PP-OCRv6 models.

This plugin seamlessly integrates with Docling's standard pipeline to provide local OCR capabilities using PaddlePaddle's PP-OCRv6 models. It runs the PP-OCRv6 detection and recognition ONNX checkpoints locally through RapidOCR (onnxruntime), so OCR happens inside the docling worker — no external service required.


GitHub  |  PyPI


PyPI version Python versions License CI Ruff Coverage

GPU acceleration is automatic when the docling accelerator device resolves to CUDA and onnxruntime-gpu is installed.

Installation

Pick exactly one onnxruntime extra — installing both the CPU and GPU wheels at once is unsupported and prevents the CUDA provider from registering:

pip install "docling-pp-ocrv6[cpu]"     # CPU (onnxruntime)
pip install "docling-pp-ocrv6[gpu]"     # CUDA (onnxruntime-gpu)

The detection and recognition ONNX models are downloaded from HuggingFace on first use and cached under docling's model cache. To pre-fetch them (e.g. at container build time):

from docling_pp_ocrv6 import PPOCRv6Model
PPOCRv6Model.download_models()

Usage

from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling_pp_ocrv6 import PPOCRv6Options

pipeline_options = PdfPipelineOptions(do_ocr=True)
pipeline_options.ocr_options = PPOCRv6Options()

converter = DocumentConverter(
    format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)}
)
result = converter.convert("scanned.pdf")
print(result.document.export_to_markdown())

With docling-serve, request the engine by its kind:

{ "options": { "ocr": true, "ocr_engine": "pp-ocrv6" } }

(DOCLING_SERVE_ALLOW_EXTERNAL_PLUGINS=true must be set for the plugin to load.)

Configuration

All options are settable via PPOCRv6Options(...) or environment variables:

Option Env var Default
lang PPOCRV6_LANG de,en,fr,it,es,nl,pt,... (German-led European set)
text_score PPOCRV6_TEXT_SCORE 0.5
use_det / use_cls / use_rec PPOCRV6_USE_DET / _CLS / _REC true
det_repo PPOCRV6_DET_REPO PaddlePaddle/PP-OCRv6_medium_det_onnx
rec_repo PPOCRV6_REC_REPO PaddlePaddle/PP-OCRv6_medium_rec_onnx
det_model_path / rec_model_path / rec_keys_path / cls_model_path PPOCRV6_*_MODEL_PATH / _KEYS_PATH auto

The recognition character dictionary is extracted automatically from the recognition model's inference.yml. Angle classification uses RapidOCR's bundled cls model unless cls_model_path is set.

Development

make install   # uv sync + pre-commit
make check     # ruff lint + format check + ty type check
make test      # pytest with coverage

License

MIT