mirror of
https://github.com/sml2h3/ocr_api_server.git
synced 2025-05-04 08:29:24 +08:00
bump version
This commit is contained in:
parent
7f37543ffb
commit
9271927615
10
Dockerfile
10
Dockerfile
@ -1,17 +1,15 @@
|
|||||||
FROM python:3.8-slim-buster
|
FROM python:3.10-slim-buster
|
||||||
|
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
|
|
||||||
COPY ./*.txt ./*.py ./*.sh ./*.onnx /app/
|
COPY ./*.txt ./*.py ./*.sh ./*.onnx /app/
|
||||||
|
|
||||||
|
|
||||||
RUN cd /app \
|
RUN cd /app \
|
||||||
&& python3 -m pip install --upgrade pip -i https://pypi.douban.com/simple/\
|
&& python3 -m pip install -U pip\
|
||||||
&& pip3 install --no-cache-dir -r requirements.txt --extra-index-url https://pypi.douban.com/simple/ \
|
&& pip3 install --no-cache-dir -r requirements.txt \
|
||||||
&& rm -rf /tmp/* && rm -rf /root/.cache/* \
|
&& 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
|
&& apt-get --allow-releaseinfo-change update && apt install libgl1-mesa-glx libglib2.0-0 -y
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
CMD ["python3", "ocr_server.py", "--port", "9898", "--ocr", "--det"]
|
CMD ["python3", "ocr_server.py", "--port", "9898", "--ocr"]
|
||||||
|
30
README.md
30
README.md
@ -1,7 +1,7 @@
|
|||||||
# ocr_api_server
|
# ocr_api_server
|
||||||
使用ddddocr的最简api搭建项目,支持docker
|
使用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下部署)
|
## docker运行方式(目测只能在Linux下部署)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
# clone repo
|
||||||
git clone https://github.com/sml2h3/ocr_api_server.git
|
git clone https://github.com/sml2h3/ocr_api_server.git
|
||||||
# docker怎么安装?百度吧
|
|
||||||
|
# install docker
|
||||||
|
curl -Lso- https://get.docker.com | bash
|
||||||
|
|
||||||
cd ocr_api_server
|
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})
|
# 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())
|
# 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": ""}'
|
||||||
|
```
|
@ -1,2 +1,3 @@
|
|||||||
ddddocr>=1.3.1
|
ddddocr>=1.3.1
|
||||||
flask
|
flask
|
||||||
|
Pillow==9.5.0
|
Loading…
Reference in New Issue
Block a user