Skip to main content

multi-ocr

多引擎 OCR 工具包,将 PDF 和图片转换为 Markdown 文档。

  • CLI 工具:全局安装后一行命令完成 OCR
  • SDK 依赖:作为 Python 库集成到你的项目中

支持的引擎

引擎 说明 类型 场景 费用
SiliconFlow + DeepSeek-OCR 云端 OCR,精度高 API 图片+PDF 免费
SiliconFlow + PaddleOCR-VL-1.5 云端 OCR,轻量快速 API 图片+PDF 免费
LiteParse 本地 PDF 解析,无需联网 本地 PDF 免费
Ollama + DeepSeek-OCR 本地部署 OCR 本地 图片+PDF 免费

本地运行 ollama 参考:https://ollama.com/library/deepseek-ocr

安装

CLI 全局安装

uv tool install multi-ocr-py
# 或
pip install multi-ocr-py

SDK 依赖安装

pip install multi-ocr-py
# 或
uv add multi-ocr-py

CLI 使用

# 单文件 OCR
multi-ocr document.pdf

# 指定引擎和页码范围
multi-ocr document.pdf --model liteparse --pages 1-5

# 批量处理目录,4个并发
multi-ocr ./scans/ --model silicon-deepseek-ocr -j 4

# 查看帮助
multi-ocr -h

环境变量

引擎 环境变量
SiliconFlow SILICONFLOW_API_KEY
Ollama OLLAMA_BASE_URL(可选,默认 http://127.0.0.1:11434)

SDK 使用

from pathlib import Path
from multi_ocr import get_engine, ocr_file, OCREngine

# 创建引擎
engine = get_engine(
    provider="siliconflow",
    model="deepseek-ai/DeepSeek-OCR",
    api_key="your-api-key",
)

# 识别图片
text = engine.parse_image(Path("scan.jpg"))

# 识别 PDF
result = ocr_file(Path("document.pdf"), engine, pages="1-3")

# 批量处理目录
from multi_ocr import ocr_directory
ocr_directory(Path("./scans/"), engine, concurrency=4)

自定义引擎

from multi_ocr import OCREngine

class MyEngine(OCREngine):
    def parse_image(self, image_path: Path) -> str:
        # 你的 OCR 逻辑
        return "recognized text"

要求

  • Python >= 3.11

协议

MIT License

Metadata

Release files for multi-ocr-py 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multi-ocr-py 0.2.2
File Size Uploaded Provenance
multi_ocr_py-0.2.2.tar.gz 1.0 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for multi-ocr-py 0.2.2
File Interpreter ABI Platform
multi_ocr_py-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / multi_ocr_py-0.2.2.tar.gz

Download URL multi_ocr_py-0.2.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
342279dff5c7669f5b6c8ff78cfb24ef9b18c169b27fe8843e51de6cd36d8be0
BLAKE2b-256 checksum
How to use checksums
03c8b179f29fb5c85683cb06ae4fbfcfc29b8a4b392bdc843567ca9950ee4d0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / multi_ocr_py-0.2.2-py3-none-any.whl

Download URL multi_ocr_py-0.2.2-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40093d080de1ad593ae430da1de5a0dfaf966d271ca86369f54e0d4695b67ef2
BLAKE2b-256 checksum
How to use checksums
651a7e43d67610f865465cf291a8c3d5ab813df6e93b852a5582f2af83aafffa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for multi-ocr-py 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page