Skip to content

Commit

Permalink
docs(rapidocr_api): fix typo errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Nov 3, 2024
1 parent 411148a commit e69fc88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 62 deletions.
11 changes: 4 additions & 7 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ ENV DEBIAN_FRONTEND=noninteractive
# 设置工作目录
WORKDIR /app

RUN pip install --no-cache-dir rapidocr_api -i https://mirrors.aliyun.com/pypi/simple

RUN pip uninstall -y opencv-python && \
RUN set -eux; \
pip install --no-cache-dir rapidocr_api -i https://mirrors.aliyun.com/pypi/simple; \
pip uninstall -y opencv-python; \
pip install --no-cache-dir opencv-python-headless -i https://mirrors.aliyun.com/pypi/simple

EXPOSE 9003

# 升级后可用
# CMD ["bash", "-c", "rapidocr_api -ip 0.0.0.0 -p 9003 -workers 2"]
CMD ["rapidocr_api"]

CMD ["bash", "-c", "rapidocr_api -ip 0.0.0.0 -p 9003 -workers 2"]
55 changes: 0 additions & 55 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1 @@
### See [Documentation](https://rapidai.github.io/RapidOCRDocs/install_usage/rapidocr_api/usage/)

### API 修改说明

* uvicorn启动时,reload参数设置为False,避免反复加载;
* 增加了启动参数: workers,可启动多个实例,以满足多并发需求。
* 可通过环境变量传递模型参数:det_model_path, cls_model_path, rec_model_path;
* 接口中可传入参数,控制是否使用检测、方向分类和识别这三部分的模型;客户端调用见`demo.py`
* 增加了Dockerfile,可自行构建镜像。

启动服务端:

Windows下启动:

```shell
set det_model_path=I:\models\图像相关\OCR\RapidOCR\PP-OCRv4\ch_PP-OCRv4_det_server_infer.onnx
set det_model_path=

set rec_model_path=I:\models\图像相关\OCR\RapidOCR\PP-OCRv4\ch_PP-OCRv4_rec_server_infer.onnx
rapidocr_api
```

Linux下启动:

```shell
# 默认参数启动
rapidocr_api

# 指定参数:端口与进程数量;
rapidocr_api -ip 0.0.0.0 -p 9005 -workers 2

# 指定模型
expert det_model_path=/mnt/sda1/models/PP-OCRv4/ch_PP-OCRv4_det_server_infer.onnx
expert rec_model_path=/mnt/sda1/models/PP-OCRv4/ch_PP-OCRv4_rec_server_infer.onnx
rapidocr_api -ip 0.0.0.0 -p 9005 -workers 2
```

客户端调用说明:

```bash
cd api
python demo.py
```

构建镜像:

```bash
cd api
sudo docker build -t="rapidocr_api:0.1.1" .
```

启动镜像:

```bash
docker run -p 9003:9003 --name rapidocr_api1 --restart always -d rapidocr_api:0.1.1
```

0 comments on commit e69fc88

Please sign in to comment.