https://github.com/rapidai/rapidocrapi
🖇 A cross platform OCR API Library based on RapidOCR
https://github.com/rapidai/rapidocrapi
api ocr rapidocr
Last synced: 3 months ago
JSON representation
🖇 A cross platform OCR API Library based on RapidOCR
- Host: GitHub
- URL: https://github.com/rapidai/rapidocrapi
- Owner: RapidAI
- License: apache-2.0
- Created: 2025-05-06T00:27:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-27T08:44:48.000Z (11 months ago)
- Last Synced: 2025-06-27T09:33:31.791Z (11 months ago)
- Topics: api, ocr, rapidocr
- Language: Python
- Homepage: https://rapidai.github.io/RapidOCRDocs/main/install_usage/rapidocr_api/usage/
- Size: 93.8 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
### 📖 简介
- 该包是将[rapidocr](./rapidocr/install.md)库做了API封装,采用[FastAPI](https://fastapi.tiangolo.com/) + [uvicorn](https://www.uvicorn.org/)实现。
- 定位是一个快速调用`rapidocr`的API接口,没有考虑多进程处理并发请求,如果有这需求的小伙伴,可以看看[gunicorn](https://gunicorn.org/)等。
### 📌 版本依赖关系
|`rapidocr_api`|`rapidocr`|
|:---|:---|
|`v0.2.x`|`rapidocr>1.0.0,<3.0.0`|
|`v0.1.x`|`rapidocr_onnxruntime`|
### 🛠️ 安装
```bash linenums="1"
pip install rapidocr_api
```
### 🚀 使用
#### ▶️ 启动服务
```bash
# 默认参数启动
rapidocr_api
# 指定参数:端口与进程数量;
rapidocr_api -ip 0.0.0.0 -p 9005 -workers 2
```
#### 📞 调用服务
💻 命令行使用:
```bash
curl -F image_file=@1.png http://0.0.0.0:9003/ocr
```
🐍 Python脚本使用:
```python
import requests
url = 'http://localhost:9003/ocr'
img_path = 'tests/test_files/ch_en_num.jpg'
with open(img_path, 'rb') as f:
file_dict = {'image_file': (img_path, f, 'image/png')}
response = requests.post(url, files=file_dict, timeout=60)
print(response.json())
```
### 📚 文档
完整文档请移步:[docs](https://rapidai.github.io/RapidOCRDocs/main/install_usage/rapidocr_api/usage/)