文档

PredictTemplateModel - 模板服务预测API

更新时间:

模板服务预测目前包括两种类型:自定义KV模板和自定义表格模板。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
TaskIdlong

任务 ID

1
Contentstring

图片或 pdf 文件访问 URL 地址

https://doc-automl-public.oss-cn-hangzhou.aliyuncs.com/demo/demo.png
BinaryToTextboolean

content 字段是图片 URL 时:false body 为 base64 的内容时:true

false:表示content传入的是url true:表示body是直接传入图片进行base64的内容
Bodystring

图片 base64 编码内容

data:image/png;base64,xxxxx

content 字段和 body 字段传参二选一,图片 URL 则 content 为图片访问地址。内容为 base64 编码则传参 body,且 BinaryToText 传 true。

pdf 限制 20Mb 10 页 除长文档类型的模型预测以外,其他预测服务只会取第一页进行预测。

返回参数

名称类型描述示例值
object

Schema of Response

RequestIdstring

Id of the request

F25FBAB4-665A-5D85-8AEF-39AE29F7D588
Dataobject

返回数据

{ "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" }
Messagestring

返回消息

successful
Codestring

状态码。说明 200 表示成功。

200
模板服务预测接口,返回 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错误码错误信息
20021002模板预测超时
20021003模板预测失败
20021004模板提交失败
20010001参数出错
20010005服务不存在
20021018未找到模板信息
20016001未找到可预测的模型
20016004指定的模型不存在
20023002获取资源HTTP异常
20022002ocr服务异常
20011002账号没有开通服务
20019999未知异常

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2023-04-10OpenAPI 错误码发生变更、OpenAPI 入参发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    删除错误码:200
入参OpenAPI 入参发生变更
    新增入参:Body
    删除入参:body
2023-03-31OpenAPI 错误码发生变更、OpenAPI 入参发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    删除错误码:200
入参OpenAPI 入参发生变更
    新增入参:body
2023-03-23OpenAPI 错误码发生变更、OpenAPI 返回结构发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    删除错误码:200
出参OpenAPI 返回结构发生变更