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.1

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.1
File Size Uploaded Provenance
multi_ocr_py-0.2.1.tar.gz 1.0 MB Without provenance Details

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / multi_ocr_py-0.2.1.tar.gz

Download URL multi_ocr_py-0.2.1.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
50d690b49a7e931a0ae8b5731ee2283dd4043a25568b5d8a7814c4bb53c6a541
BLAKE2b-256 checksum
How to use checksums
74e479853ce2e22d74ff26cc28671d0ea063ec596239fecfe0e95a5f2aff83c6
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.1-py3-none-any.whl

Download URL multi_ocr_py-0.2.1-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef5765a79ea1d783d35d744b803b2029a2b48a522e1d60fe300c62762e4058d8
BLAKE2b-256 checksum
How to use checksums
fa89539095ea87d838070d7c2c30435c3bf01e9f2272daa8dab9c4cf941ae4fb
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.1

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