模板服務預測目前包括兩種類型:自定義KV模板和自定義表格模板。
調試
您可以在OpenAPI Explorer中直接運行該接口,免去您計算簽名的困擾。運行成功后,OpenAPI Explorer可以自動生成SDK代碼示例。
授權信息
當前API暫無授權信息透出。
請求參數
名稱 | 類型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
TaskId | long | 是 | 任務 ID | 1 |
Content | string | 否 | 圖片或 pdf 文件訪問 URL 地址 | https://doc-automl-public.oss-cn-hangzhou.aliyuncs.com/demo/demo.png |
BinaryToText | boolean | 否 | content 字段是圖片 URL 時:false body 為 base64 的內容時:true | false:表示content傳入的是url true:表示body是直接傳入圖片進行base64的內容 |
Body | string | 否 | 圖片 base64 編碼內容 | data:image/png;base64,xxxxx |
content 字段和 body 字段傳參二選一,圖片 URL 則 content 為圖片訪問地址。內容為 base64 編碼則傳參 body,且 BinaryToText 傳 true。
pdf 限制 20Mb 10 頁 除長文檔類型的模型預測以外,其他預測服務只會取第一頁進行預測。
返回參數
模板服務預測接口,返回 Data 字段解釋說明:
score 預測服務置信度 0-1
data. 算法返回的預測結果,數組格式
prob 算法結果置信度 0-1
fieldName 抽取 key
fieldWord 抽取 value
location 抽取結果坐標位置 { "x": 119,"y": 48 }表示頁面坐標點
wordInfo 抽取內容詳細信息,包括了每個字符的位置信息
specificType 算法類型(infoCustomeKvTemp:自定義 KV 模板,infoCustomeTableTemp:自定義表格模板,ocr_infoExtractBill:信息抽取 OCR 識別,infoExtractBill:單據票證抽取,infoExtractDoc:長文檔信息抽取 )
classType 模型預測服務、模板預測服務
predictFile 預測文件地址(失效時間 60 分鐘)
示例
正常返回示例
JSON
格式
{
"RequestId": "F25FBAB4-665A-5D85-8AEF-39AE29F7D588",
"Data": {
"score": 0.9091,
"data": [
{
"prob": 1,
"fieldName": "姓名",
"fieldWordRaw": "方大呆",
"wordInfo": [
{
"prob": 0.9899999999999999,
"location": [
{
"x": 119,
"y": 48
},
{
"x": 199,
"y": 48
},
{
"x": 199,
"y": 69
},
{
"x": 119,
"y": 69
}
],
"word": "方大呆",
"charInfo": [
{
"prob": 0.99,
"location": [
{
"x": 119,
"y": 48
},
{
"x": 142,
"y": 48
},
{
"x": 142,
"y": 67
},
{
"x": 119,
"y": 67
}
],
"word": "方"
},
{
"prob": 0.99,
"location": [
{
"x": 142,
"y": 48
},
{
"x": 165,
"y": 48
},
{
"x": 165,
"y": 67
},
{
"x": 142,
"y": 67
}
],
"word": "大"
},
{
"prob": 0.99,
"location": [
{
"x": 167,
"y": 48
},
{
"x": 197,
"y": 48
},
{
"x": 197,
"y": 67
},
{
"x": 167,
"y": 67
}
],
"word": "呆"
}
]
}
],
"location": [
{
"x": 119,
"y": 48
},
{
"x": 199,
"y": 48
},
{
"x": 199,
"y": 69
},
{
"x": 119,
"y": 69
}
],
"fieldWord": "方大呆"
},
{
"prob": 1,
"fieldName": "性別",
"fieldWordRaw": "男",
"wordInfo": [
{
"prob": 0.99,
"location": [
{
"x": 117,
"y": 93
},
{
"x": 142,
"y": 93
},
{
"x": 142,
"y": 112
},
{
"x": 117,
"y": 112
}
],
"word": "男",
"charInfo": [
{
"prob": 0.99,
"location": [
{
"x": 117,
"y": 93
},
{
"x": 142,
"y": 93
},
{
"x": 142,
"y": 112
},
{
"x": 117,
"y": 112
}
],
"word": "男"
}
]
}
],
"location": [
{
"x": 117,
"y": 93
},
{
"x": 142,
"y": 93
},
{
"x": 142,
"y": 112
},
{
"x": 117,
"y": 112
}
],
"fieldWord": "男"
},
{
"prob": 1,
"fieldName": "身份證號",
"fieldWordRaw": "310101********3222",
"wordInfo": [
{
"prob": 0.9899999999999998,
"location": [
{
"x": 206,
"y": 301
},
{
"x": 518,
"y": 301
},
{
"x": 518,
"y": 320
},
{
"x": 206,
"y": 320
}
],
"word": "310101198610203222",
"charInfo": [
{
"prob": 0.99,
"location": [
{
"x": 206,
"y": 302
},
{
"x": 223,
"y": 302
},
{
"x": 223,
"y": 319
},
{
"x": 206,
"y": 319
}
],
"word": "3"
},
{
"prob": 0.99,
"location": [
{
"x": 223,
"y": 302
},
{
"x": 238,
"y": 302
},
{
"x": 238,
"y": 319
},
{
"x": 223,
"y": 319
}
],
"word": "1"
},
{
"prob": 0.99,
"location": [
{
"x": 240,
"y": 302
},
{
"x": 255,
"y": 302
},
{
"x": 255,
"y": 319
},
{
"x": 240,
"y": 319
}
],
"word": "0"
},
{
"prob": 0.99,
"location": [
{
"x": 259,
"y": 302
},
{
"x": 274,
"y": 302
},
{
"x": 274,
"y": 319
},
{
"x": 259,
"y": 319
}
],
"word": "1"
},
{
"prob": 0.99,
"location": [
{
"x": 276,
"y": 302
},
{
"x": 291,
"y": 302
},
{
"x": 291,
"y": 319
},
{
"x": 276,
"y": 319
}
],
"word": "0"
},
{
"prob": 0.99,
"location": [
{
"x": 292,
"y": 302
},
{
"x": 307,
"y": 302
},
{
"x": 307,
"y": 319
},
{
"x": 292,
"y": 319
}
],
"word": "1"
},
{
"prob": 0.99,
"location": [
{
"x": 311,
"y": 302
},
{
"x": 326,
"y": 302
},
{
"x": 326,
"y": 319
},
{
"x": 311,
"y": 319
}
],
"word": "1"
},
{
"prob": 0.99,
"location": [
{
"x": 328,
"y": 302
},
{
"x": 343,
"y": 302
},
{
"x": 343,
"y": 319
},
{
"x": 328,
"y": 319
}
],
"word": "9"
},
{
"prob": 0.99,
"location": [
{
"x": 344,
"y": 302
},
{
"x": 359,
"y": 302
},
{
"x": 359,
"y": 319
},
{
"x": 344,
"y": 319
}
],
"word": "8"
},
{
"prob": 0.99,
"location": [
{
"x": 361,
"y": 302
},
{
"x": 376,
"y": 302
},
{
"x": 376,
"y": 319
},
{
"x": 361,
"y": 319
}
],
"word": "6"
},
{
"prob": 0.99,
"location": [
{
"x": 380,
"y": 302
},
{
"x": 395,
"y": 302
},
{
"x": 395,
"y": 319
},
{
"x": 380,
"y": 319
}
],
"word": "1"
},
{
"prob": 0.99,
"location": [
{
"x": 396,
"y": 302
},
{
"x": 411,
"y": 302
},
{
"x": 411,
"y": 319
},
{
"x": 396,
"y": 319
}
],
"word": "0"
},
{
"prob": 0.99,
"location": [
{
"x": 415,
"y": 302
},
{
"x": 430,
"y": 302
},
{
"x": 430,
"y": 319
},
{
"x": 415,
"y": 319
}
],
"word": "2"
},
{
"prob": 0.99,
"location": [
{
"x": 432,
"y": 302
},
{
"x": 447,
"y": 302
},
{
"x": 447,
"y": 319
},
{
"x": 432,
"y": 319
}
],
"word": "0"
},
{
"prob": 0.99,
"location": [
{
"x": 448,
"y": 302
},
{
"x": 463,
"y": 302
},
{
"x": 463,
"y": 319
},
{
"x": 448,
"y": 319
}
],
"word": "3"
},
{
"prob": 0.99,
"location": [
{
"x": 467,
"y": 302
},
{
"x": 482,
"y": 302
},
{
"x": 482,
"y": 319
},
{
"x": 467,
"y": 319
}
],
"word": "2"
},
{
"prob": 0.99,
"location": [
{
"x": 484,
"y": 302
},
{
"x": 499,
"y": 302
},
{
"x": 499,
"y": 319
},
{
"x": 484,
"y": 319
}
],
"word": "2"
},
{
"prob": 0.99,
"location": [
{
"x": 501,
"y": 302
},
{
"x": 516,
"y": 302
},
{
"x": 516,
"y": 319
},
{
"x": 501,
"y": 319
}
],
"word": "2"
}
]
}
],
"location": [
{
"x": 206,
"y": 301
},
{
"x": 518,
"y": 301
},
{
"x": 518,
"y": 320
},
{
"x": 206,
"y": 320
}
],
"fieldWord": "310101198610203222"
},
{
"prob": 1,
"fieldName": "名族",
"fieldWordRaw": "漢",
"wordInfo": [
{
"prob": 0.99,
"location": [
{
"x": 232,
"y": 94
},
{
"x": 259,
"y": 94
},
{
"x": 259,
"y": 112
},
{
"x": 232,
"y": 112
}
],
"word": "漢",
"charInfo": [
{
"prob": 0.99,
"location": [
{
"x": 232,
"y": 94
},
{
"x": 259,
"y": 94
},
{
"x": 259,
"y": 112
},
{
"x": 232,
"y": 112
}
],
"word": "漢"
}
]
}
],
"location": [
{
"x": 232,
"y": 94
},
{
"x": 259,
"y": 94
},
{
"x": 259,
"y": 112
},
{
"x": 232,
"y": 112
}
],
"fieldWord": "漢"
}
],
"specificType": "infoCustomeKvTemp",
"width": 586,
"angle": 0,
"classType": "template",
"height": 374,
"predictFile": "https://doc-automl-public.oss-cn-hangzhou.aliyuncs.com/demo/demo.png"
},
"Message": "successful",
"Code": "200"
}
錯誤碼
HTTP status code | 錯誤碼 | 錯誤信息 |
---|---|---|
200 | 21002 | 模板預測超時 |
200 | 21003 | 模板預測失敗 |
200 | 21004 | 模板提交失敗 |
200 | 10001 | 參數出錯 |
200 | 10005 | 服務不存在 |
200 | 21018 | 未找到模板信息 |
200 | 16001 | 未找到可預測的模型 |
200 | 16004 | 指定的模型不存在 |
200 | 23002 | 獲取資源HTTP異常 |
200 | 22002 | ocr服務異常 |
200 | 11002 | 賬號沒有開通服務 |
200 | 19999 | 未知異常 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
變更時間 | 變更內容概要 | 操作 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
2023-04-10 | OpenAPI 錯誤碼發生變更、OpenAPI 入參發生變更 | 看變更集 | ||||||||||
| ||||||||||||
2023-03-31 | OpenAPI 錯誤碼發生變更、OpenAPI 入參發生變更 | 看變更集 | ||||||||||
| ||||||||||||
2023-03-23 | OpenAPI 錯誤碼發生變更、OpenAPI 返回結構發生變更 | 看變更集 | ||||||||||
|