multi-ocr
多引擎 OCR 工具包,将 PDF 和图片转换为 Markdown 文档。
- CLI 工具:全局安装后一行命令完成 OCR
- SDK 依赖:作为 Python 库集成到你的项目中
支持的引擎
| 引擎 | 说明 | 类型 |
|---|---|---|
| SiliconFlow + DeepSeek-OCR | 云端 OCR,精度高 | API |
| SiliconFlow + PaddleOCR-VL-1.5 | 云端 OCR,轻量快速 | API |
| DashScope + Qwen-VL-OCR | 阿里云百炼 | API |
| LiteParse | 本地 PDF 解析,无需联网 | 本地 |
| Ollama + DeepSeek-OCR | 本地部署 OCR | 本地 |
安装
CLI 全局安装
uv tool install multi-ocr
# 或
pip install multi-ocr
SDK 依赖安装
pip install multi-ocr
# 或
uv add multi-ocr
CLI 使用
# 单文件 OCR
multi-ocr document.pdf
# 指定引擎和页码范围
multi-ocr document.pdf --model dashscope-qwen-vl-ocr --pages 1-5
# 批量处理目录
multi-ocr ./scans/ --model silicon-deepseek-ocr -j 4
# 查看帮助
multi-ocr --help
环境变量
| 引擎 | 环境变量 |
|---|---|
| SiliconFlow | SILICONFLOW_API_KEY |
| DashScope | DASHSCOPE_API_KEY |
| Ollama | OLLAMA_BASE_URL(可选,默认 http://127.0.0.1:11434) |
也可通过 --api-key 参数直接传入。
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.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| multi_ocr_py-0.1.0.tar.gz | 1.0 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| multi_ocr_py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / multi_ocr_py-0.1.0.tar.gz
| Download URL | multi_ocr_py-0.1.0.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16e42d3b3cf193696abe54084ca8f614baccee81d51ddb68314aa767fe56f969
|
|
BLAKE2b-256 checksum How to use checksums |
8ae43fcf66ec9c1497fa850ba77a76c67f7019e56132e0857910ed255f5dcdce
|
| 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.1.0-py3-none-any.whl
| Download URL | multi_ocr_py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f2fe7958911165942d471c2eccef0d84e6b70e2d159a0619d8fafd1377a317a
|
|
BLAKE2b-256 checksum How to use checksums |
47562a56d3dfedceca31d32523650104d95ef903b5bc4d68728b2f37728c1327
|
| 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.1.0
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.