- gunicorn.config.py:
- gunicorn配置文件,可更改进程数,默认5。 在构建镜像前更改可生效。
- Dockerfile:
- Docker镜像的描述文件。
#构建镜像
docker build -t fastapi_ocr:1.2 .
#创建容器
docker run -d --name IDCard_OCR -p 8000:8000 fastapi_ocr:1.2
#load镜像
docker load -i images.tar
#创建容器
docker run -d --name IDCard_OCR -p 8000:8000 fastapi_ocr:1.2
http://ip:8000/docs
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
#port:9999
nohup gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:9999 &
the information on the front of the IDCard
- file: [身份证正面图片]
- { "code": 200 "message": "Success" "data": "the information on the front of the IDCard" }
- "data":
- 身份证正面信息
- base64 of 头像.jpg
- "data":
- { "code": 400 "message": "Error message" "data": "null" }
- "message":
- 图片上传错误
- "message":
the information on the back of the IDCard
- file: [身份证背面图片]
- { "code": 200 "message": "Success" "data": "the information on the back of the IDCard" }
- "data":
- 身份证背面信息
- { "code": 400 "message": "Error message" "data": "null" }
- "message":
- 图片上传错误
- "message":
the information of the IDCard
- files: [身份证正面图片,身份证反面图片]
- { "code": 200 "message": "Success" "data": "the information of the IDCard" }
- "data":
- 身份证正面信息
- 身份证反面信息
- base64 of 头像.jpg
- { "code": 400 "message": "Error message" "data": "null" }
- "message":
- 图片上传错误
- "message":
- 增加ocr大模型的api接口,提高精准度但会降低识别效率。