更新 README.md
This commit is contained in:
37
README.md
37
README.md
@@ -25,3 +25,40 @@ PP-OCRv4模型:
|
||||
```bash
|
||||
./run_in_docker.sh python3 app.py
|
||||
```
|
||||
http接口如下:
|
||||
```
|
||||
post /predict
|
||||
Content-Type: application/json
|
||||
# Request body:
|
||||
{
|
||||
files={'image': f},
|
||||
data= {'image_name': "test.jpg"} # 图片文件名
|
||||
}
|
||||
# Response:
|
||||
{
|
||||
"success": True,
|
||||
"result": [] #json_list
|
||||
}
|
||||
```
|
||||
json_list格式如下:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"bbox": [0, 0, 100, 200], // 分别[左上角x,左上角y,右下角x,右下角y]
|
||||
"type": "", // 图片区域的类型,目前仅支持 Title
|
||||
"content": "今天", // 不同类型的内容不同,但都是“块”里的内容,目前为文本内容
|
||||
"page": 1, // 目前都是1
|
||||
"score": 0.9 // 版面分析,划出该 bbox 的 confidence 分数
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
- python请求示例
|
||||
```python
|
||||
f = open(local_image_path, "rb")
|
||||
res = requests.post(f"http://127.0.0.1:8080/predict", files={'image': f},data={'image_name': "a.jpg"}).json()
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user