Skip to content

Commit 4ebfbbd

Browse files
committed
8.12 auto-commit
1 parent a234533 commit 4ebfbbd

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

CHANGELOG.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
8.12
2+
* 修复触控异常
3+
* 添加部分工具脚本
4+
* 增强稳定性
5+
16
8.10
27
* 优化自恢复逻辑
38
* 优化触控兼容性

lamda/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#
33
# Distributed under MIT license.
44
# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5-
__version__ = "8.10"
5+
__version__ = "8.12"

tools/paddle_ocr_http_api.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python3
2+
# THIS IS EXAMPLE HTTP OCR BACKEND,
3+
# DO NOT USE IN PRODUCTION
4+
import uvicorn
5+
import asyncio
6+
import paddle as paddle
7+
from paddleocr import PaddleOCR
8+
from fastapi import FastAPI, Request
9+
10+
app = FastAPI()
11+
12+
13+
@app.post("/ocr")
14+
async def ocr(request: Request):
15+
image = await request.body()
16+
r = await asyncio.to_thread(ocr.ocr, image)
17+
n = bool(r and r[0] and type(r[0][-1])==float)
18+
result = (r if n else r[0]) or []
19+
output = [[n[0], n[1][0], n[1][1]] for n in result]
20+
return output
21+
22+
23+
if __name__ == "__main__":
24+
ocr = PaddleOCR(use_gpu=False, drop_score=0.85,
25+
use_space_char=True)
26+
uvicorn.run(app, host="0.0.0.0", port=8000)

0 commit comments

Comments
 (0)