Skip to content

Commit

Permalink
feat(rapidocr_api): add uvicorn timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Jan 1, 2025
1 parent 8913c7a commit f53c640
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 65 deletions.
48 changes: 0 additions & 48 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1 @@
### See [Documentation](https://rapidai.github.io/RapidOCRDocs/install_usage/rapidocr_api/usage/)

### Dockerfile简单用法:
build时使用宿主的网络
```
docker build -t rapidocr_api:0.1.4 --network host .
```

使用宿主上的代理
```
docker build -t rapidocr_api:0.1.4 --network host --build-arg HTTP_PROXY=http://127.0.0.1:8888 --build-arg HTTPS_PROXY=http://127.0.0.1:8888 .
```

调试运行:
```
docker run --rm -p 9003:9003 --name rapidocr_api -e TZ=Asia/Shanghai rapidocr_api:0.1.4
```

运行:
```
docker run -d -p 9003:9003 --name rapidocr_api -e TZ=Asia/Shanghai rapidocr_api:0.1.4
```

接口web界面:
```
http://<ip>:9003/docs
```

### Docker 临时修改并验证的方法:
```
docker run -p 9003:9003 --name rapidocr_api -e TZ=Asia/Shanghai rapidocr_api:0.1.4
```
进入container修改python源文件,Dockerfile最好加上apt-get install vim安装
```
docker exec -it rapidocr_api /bin/bash
cd /usr/local/lib/python3.10/site-packages/rapidocr_api
...
# 修改参数文件
vi /usr/local/lib/python3.10/site-packages/rapidocr_onnxruntime/config.yaml
# 改好后exit退出
```
重启container
```
docker restart rapidocr_api
```
查看日志:
```
docker logs -f rapidocr_api
```
12 changes: 0 additions & 12 deletions api/demo.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]

# import requests

# url = "http://localhost:9003/ocr"
# img_path = "../python/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.text)

import base64
import time

Expand Down
2 changes: 1 addition & 1 deletion api/rapidocr_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def main():
"-workers", "--workers", type=int, default=1, help="number of worker process"
)
args = parser.parse_args()

# 修改 uvicorn 的默认日志配置
log_config = uvicorn.config.LOGGING_CONFIG
log_config["formatters"]["access"]["fmt"] = "%(asctime)s %(levelname)s %(message)s"
Expand Down
4 changes: 0 additions & 4 deletions python/rapidocr_onnxruntime/readme.md

This file was deleted.

0 comments on commit f53c640

Please sign in to comment.