bump version

This commit is contained in:
charSLee 2023-10-15 17:02:02 +08:00
parent 7f37543ffb
commit 9271927615
3 changed files with 34 additions and 9 deletions

View File

@ -1,17 +1,15 @@
FROM python:3.8-slim-buster
FROM python:3.10-slim-buster
RUN mkdir /app
COPY ./*.txt ./*.py ./*.sh ./*.onnx /app/
RUN cd /app \
&& python3 -m pip install --upgrade pip -i https://pypi.douban.com/simple/\
&& pip3 install --no-cache-dir -r requirements.txt --extra-index-url https://pypi.douban.com/simple/ \
&& python3 -m pip install -U pip\
&& pip3 install --no-cache-dir -r requirements.txt \
&& rm -rf /tmp/* && rm -rf /root/.cache/* \
&& sed -i 's#http://deb.debian.org#http://mirrors.aliyun.com/#g' /etc/apt/sources.list\
&& apt-get --allow-releaseinfo-change update && apt install libgl1-mesa-glx libglib2.0-0 -y
WORKDIR /app
CMD ["python3", "ocr_server.py", "--port", "9898", "--ocr", "--det"]
CMD ["python3", "ocr_server.py", "--port", "9898", "--ocr"]

View File

@ -1,7 +1,7 @@
# ocr_api_server
使用ddddocr的最简api搭建项目支持docker
**建议python版本3.7-3.9 64位**
**建议python版本3.7-3.10 64位**
再有不好好看文档的我就不管了啊!!!
@ -39,8 +39,11 @@ python ocr_server.py --port 9898 --ocr --old --det
## docker运行方式(目测只能在Linux下部署)
```shell
# clone repo
git clone https://github.com/sml2h3/ocr_api_server.git
# docker怎么安装百度吧
# install docker
curl -Lso- https://get.docker.com | bash
cd ocr_api_server
@ -83,3 +86,26 @@ docker run -p 9898:9898 -d ocr_server:v1
# jsonstr = json.dumps({'target_img': target_b64str, 'bg_img': bg_b64str})
# resp = requests.post("http://{host}:{port}/slide/compare/b64", files=base64.b64encode(jsonstr.encode()).decode())
```
# 测试
请确保已经安装好`requests`库
然后执行项目内的`test_api.py`文件即可
```shell
$ python3 test_api.py
api_url='http://127.0.0.1:9898/ocr/file', resp.text='9gnb'
api_url='http://127.0.0.1:9898/ocr/file/json', resp.text='{"status": 200, "result": "9gnb", "msg": ""}'
api_url='http://127.0.0.1:9898/ocr/b64', resp.text='9gnb'
api_url='http://127.0.0.1:9898/ocr/b64/json', resp.text='{"status": 200, "result": "9gnb", "msg": ""}'
api_url='http://127.0.0.1:9898/det/file', resp.text=''
api_url='http://127.0.0.1:9898/det/file/json', resp.text='{"status": 200, "result": "", "msg": "\\u76ee\\u6807\\u68c0\\u6d4b\\u6a21\\u5757\\u6a21\\u5757\\u672a\\u5f00\\u542f"}'
api_url='http://127.0.0.1:9898/slide/match/file', resp.text="{'target_y': 45, 'target': [215, 45, 260, 91]}"
api_url='http://127.0.0.1:9898/slide/match/file/json', resp.text='{"status": 200, "result": {"target_y": 45, "target": [215, 45, 260, 91]}, "msg": ""}'
api_url='http://127.0.0.1:9898/slide/match/b64', resp.text="{'target_y': 45, 'target': [215, 45, 260, 91]}"
api_url='http://127.0.0.1:9898/slide/match/b64/json', resp.text='{"status": 200, "result": {"target_y": 45, "target": [215, 45, 260, 91]}, "msg": ""}'
api_url='http://127.0.0.1:9898/slide/compare/file', resp.text="{'target': [144, 76]}"
api_url='http://127.0.0.1:9898/slide/compare/file/json', resp.text='{"status": 200, "result": {"target": [144, 76]}, "msg": ""}'
api_url='http://127.0.0.1:9898/slide/compare/b64', resp.text="{'target': [144, 76]}"
api_url='http://127.0.0.1:9898/slide/compare/b64/json', resp.text='{"status": 200, "result": {"target": [144, 76]}, "msg": ""}'
```

View File

@ -1,2 +1,3 @@
ddddocr>=1.3.1
flask
flask
Pillow==9.5.0