模板服务预测目前包括两种类型:自定义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 返回结构发生变更 | 看变更集 | ||||||||||
|