PredictPreTrainModel

Updated at:

UIE extraction is a pre-configured capability for general-purpose pre-annotation.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

documentautoml:PredictPreTrainModel

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Content

string

No

The request content, formatted as a JSON string. Use this parameter to specify the input image by URL. For FormUIE extraction, the query field must contain the image URL, and the schema field must contain an array of field names to extract.

{"query":"https://doc-automl-public.oss-cn-hangzhou.aliyuncs.com/demo/extractBill.png", "schema":["姓名", "住址"]}

ServiceVersion

string

No

The version of the built-in capability. Default value: V1.

V1

ServiceName

string

No

The name of the built-in capability. For FormUIE extraction, set this parameter to FormUIE.

FormUIE

BinaryToText

boolean

No

Set to false if the Content parameter contains an image URL. Set to true if the Body parameter contains base64-encoded image data.

false

Body

string

No

The request content, formatted as a JSON string. Use this parameter to provide the image as base64-encoded data. For FormUIE extraction, the query field must contain the base64-encoded image data, and the schema field must contain an array of field names to extract.

{"query":"data:image/png;base64,xxxxx","schema":["姓名", "住址"]}

The BinaryToText parameter is optional.

The content and body fields are mutually exclusive. Use the content field for an image URL. Use the body field for base64-encoded image data, and set BinaryToText to true.

Response elements

Element

Type

Description

Example

object

The root object of the response.

RequestId

string

A unique identifier for the request.

29413C69-11EF-15CB-BE20-70D318E2F4E9

Code

integer

The status code. A value of 200 indicates that the request was successful.

200

Message

string

Returns success if the request is successful, or an error message if the request fails.

success

Data

object

The object that contains the extraction results.

{ "RequestId": "29413C69-11EF-15CB-BE20-70D318E2F4E9", "Message": "success", "Data": { "score": 1, "data": [ { "prob": 0.9138551354408264, "fieldWordRaw": "xx", "wordInfo": [ { "prob": 0.9138551354408264, "pos": [ { "x": 468, "y": 139 }, { "x": 476, "y": 139 }, { "x": 476, "y": 153 }, { "x": 468, "y": 153 } ], "word": "xx", "charInfo": [ { "prob": 0.99, "pos": [ { "x": 468, "y": 139 }, { "x": 471, "y": 139 }, { "x": 471, "y": 153 }, { "x": 468, "y": 153 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 473, "y": 139 }, { "x": 476, "y": 139 }, { "x": 476, "y": 153 }, { "x": 473, "y": 153 } ], "word": "x" } ] } ], "name": "姓名", "location": [ { "x": 468, "y": 139 }, { "x": 476, "y": 139 }, { "x": 476, "y": 153 }, { "x": 468, "y": 153 } ], "fieldWord": "xx" }, { "prob": 0.9594210982322693, "fieldWordRaw": "xxxxxxxxxxx", "wordInfo": [ { "prob": 0.9594210982322693, "pos": [ { "x": 168, "y": 164 }, { "x": 467, "y": 164 }, { "x": 467, "y": 239 }, { "x": 168, "y": 239 } ], "word": "xxxxxxxxxxx", "charInfo": [ { "prob": 0.99, "pos": [ { "x": 366, "y": 164 }, { "x": 383, "y": 164 }, { "x": 383, "y": 179 }, { "x": 366, "y": 179 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 384, "y": 164 }, { "x": 401, "y": 164 }, { "x": 401, "y": 179 }, { "x": 384, "y": 179 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 402, "y": 164 }, { "x": 414, "y": 164 }, { "x": 414, "y": 179 }, { "x": 402, "y": 179 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 418, "y": 164 }, { "x": 427, "y": 164 }, { "x": 427, "y": 179 }, { "x": 418, "y": 179 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 429, "y": 164 }, { "x": 438, "y": 164 }, { "x": 438, "y": 179 }, { "x": 429, "y": 179 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 439, "y": 164 }, { "x": 448, "y": 164 }, { "x": 448, "y": 179 }, { "x": 439, "y": 179 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 450, "y": 164 }, { "x": 467, "y": 164 }, { "x": 467, "y": 179 }, { "x": 450, "y": 179 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 168, "y": 224 }, { "x": 180, "y": 224 }, { "x": 180, "y": 239 }, { "x": 168, "y": 239 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 180, "y": 224 }, { "x": 192, "y": 224 }, { "x": 192, "y": 239 }, { "x": 180, "y": 239 } ], "word": "x" }, { "prob": 0.99, "pos": [ { "x": 195, "y": 224 }, { "x": 209, "y": 224 }, { "x": 209, "y": 239 }, { "x": 195, "y": 239 } ], "word": "1" }, { "prob": 0.99, "pos": [ { "x": 211, "y": 224 }, { "x": 223, "y": 224 }, { "x": 223, "y": 239 }, { "x": 211, "y": 239 } ], "word": "7" }, { "prob": 0.99, "pos": [ { "x": 224, "y": 224 }, { "x": 236, "y": 224 }, { "x": 236, "y": 239 }, { "x": 224, "y": 239 } ], "word": "2" }, { "prob": 0.99, "pos": [ { "x": 237, "y": 224 }, { "x": 249, "y": 224 }, { "x": 249, "y": 239 }, { "x": 237, "y": 239 } ], "word": "7" }, { "prob": 0.99, "pos": [ { "x": 253, "y": 224 }, { "x": 270, "y": 224 }, { "x": 270, "y": 239 }, { "x": 253, "y": 239 } ], "word": "x" } ] } ], "name": "住址", "location": [ { "x": 168, "y": 164 }, { "x": 467, "y": 164 }, { "x": 467, "y": 239 }, { "x": 168, "y": 239 } ], "fieldWord": "xxxxxxxx" } ], "specificType": "formuie-anti", "classType": "preDefinedServer", "predictFile": "https://xxxx" }, "Code": 200 }

The template service prediction interface returns a Data object with the following fields:
score: The overall confidence score for the prediction, ranging from 0 to 1.
data: An array of prediction results from the algorithm.
prob: The confidence score for an individual result, ranging from 0 to 1.
name: The key of an extracted key-value pair.
fieldWord: The value of an extracted key-value pair.
location: The coordinates of the extracted result's bounding box. For example, {"x": 119, "y": 48} represents the top-left corner of the bounding box.
wordInfo: Detailed information about the extracted content, including character-level position data.
specificType: The algorithm type. For example, formuie-anti indicates UIE extraction.
classType: The capability category. For example, preDefinedServer indicates a preset capability.
predictFile: The URL of the prediction output file. This URL expires in 60 minutes.









Examples

Success response

JSON format

{
  "RequestId": "29413C69-11EF-15CB-BE20-70D318E2F4E9",
  "Code": 200,
  "Message": "success",
  "Data": {
    "RequestId": "29413C69-11EF-15CB-BE20-70D318E2F4E9",
    "Message": "success",
    "Data": {
      "score": 1,
      "data": [
        {
          "prob": 0.9138551354408264,
          "fieldWordRaw": "xx",
          "wordInfo": [
            {
              "prob": 0.9138551354408264,
              "pos": [
                {
                  "x": 468,
                  "y": 139
                },
                {
                  "x": 476,
                  "y": 139
                },
                {
                  "x": 476,
                  "y": 153
                },
                {
                  "x": 468,
                  "y": 153
                }
              ],
              "word": "xx",
              "charInfo": [
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 468,
                      "y": 139
                    },
                    {
                      "x": 471,
                      "y": 139
                    },
                    {
                      "x": 471,
                      "y": 153
                    },
                    {
                      "x": 468,
                      "y": 153
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 473,
                      "y": 139
                    },
                    {
                      "x": 476,
                      "y": 139
                    },
                    {
                      "x": 476,
                      "y": 153
                    },
                    {
                      "x": 473,
                      "y": 153
                    }
                  ],
                  "word": "x"
                }
              ]
            }
          ],
          "name": "姓名",
          "location": [
            {
              "x": 468,
              "y": 139
            },
            {
              "x": 476,
              "y": 139
            },
            {
              "x": 476,
              "y": 153
            },
            {
              "x": 468,
              "y": 153
            }
          ],
          "fieldWord": "xx"
        },
        {
          "prob": 0.9594210982322693,
          "fieldWordRaw": "xxxxxxxxxxx",
          "wordInfo": [
            {
              "prob": 0.9594210982322693,
              "pos": [
                {
                  "x": 168,
                  "y": 164
                },
                {
                  "x": 467,
                  "y": 164
                },
                {
                  "x": 467,
                  "y": 239
                },
                {
                  "x": 168,
                  "y": 239
                }
              ],
              "word": "xxxxxxxxxxx",
              "charInfo": [
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 366,
                      "y": 164
                    },
                    {
                      "x": 383,
                      "y": 164
                    },
                    {
                      "x": 383,
                      "y": 179
                    },
                    {
                      "x": 366,
                      "y": 179
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 384,
                      "y": 164
                    },
                    {
                      "x": 401,
                      "y": 164
                    },
                    {
                      "x": 401,
                      "y": 179
                    },
                    {
                      "x": 384,
                      "y": 179
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 402,
                      "y": 164
                    },
                    {
                      "x": 414,
                      "y": 164
                    },
                    {
                      "x": 414,
                      "y": 179
                    },
                    {
                      "x": 402,
                      "y": 179
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 418,
                      "y": 164
                    },
                    {
                      "x": 427,
                      "y": 164
                    },
                    {
                      "x": 427,
                      "y": 179
                    },
                    {
                      "x": 418,
                      "y": 179
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 429,
                      "y": 164
                    },
                    {
                      "x": 438,
                      "y": 164
                    },
                    {
                      "x": 438,
                      "y": 179
                    },
                    {
                      "x": 429,
                      "y": 179
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 439,
                      "y": 164
                    },
                    {
                      "x": 448,
                      "y": 164
                    },
                    {
                      "x": 448,
                      "y": 179
                    },
                    {
                      "x": 439,
                      "y": 179
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 450,
                      "y": 164
                    },
                    {
                      "x": 467,
                      "y": 164
                    },
                    {
                      "x": 467,
                      "y": 179
                    },
                    {
                      "x": 450,
                      "y": 179
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 168,
                      "y": 224
                    },
                    {
                      "x": 180,
                      "y": 224
                    },
                    {
                      "x": 180,
                      "y": 239
                    },
                    {
                      "x": 168,
                      "y": 239
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 180,
                      "y": 224
                    },
                    {
                      "x": 192,
                      "y": 224
                    },
                    {
                      "x": 192,
                      "y": 239
                    },
                    {
                      "x": 180,
                      "y": 239
                    }
                  ],
                  "word": "x"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 195,
                      "y": 224
                    },
                    {
                      "x": 209,
                      "y": 224
                    },
                    {
                      "x": 209,
                      "y": 239
                    },
                    {
                      "x": 195,
                      "y": 239
                    }
                  ],
                  "word": "1"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 211,
                      "y": 224
                    },
                    {
                      "x": 223,
                      "y": 224
                    },
                    {
                      "x": 223,
                      "y": 239
                    },
                    {
                      "x": 211,
                      "y": 239
                    }
                  ],
                  "word": "7"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 224,
                      "y": 224
                    },
                    {
                      "x": 236,
                      "y": 224
                    },
                    {
                      "x": 236,
                      "y": 239
                    },
                    {
                      "x": 224,
                      "y": 239
                    }
                  ],
                  "word": "2"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 237,
                      "y": 224
                    },
                    {
                      "x": 249,
                      "y": 224
                    },
                    {
                      "x": 249,
                      "y": 239
                    },
                    {
                      "x": 237,
                      "y": 239
                    }
                  ],
                  "word": "7"
                },
                {
                  "prob": 0.99,
                  "pos": [
                    {
                      "x": 253,
                      "y": 224
                    },
                    {
                      "x": 270,
                      "y": 224
                    },
                    {
                      "x": 270,
                      "y": 239
                    },
                    {
                      "x": 253,
                      "y": 239
                    }
                  ],
                  "word": "x"
                }
              ]
            }
          ],
          "name": "住址",
          "location": [
            {
              "x": 168,
              "y": 164
            },
            {
              "x": 467,
              "y": 164
            },
            {
              "x": 467,
              "y": 239
            },
            {
              "x": 168,
              "y": 239
            }
          ],
          "fieldWord": "xxxxxxxx"
        }
      ],
      "specificType": "formuie-anti",
      "classType": "preDefinedServer",
      "predictFile": "https://xxxx"
    },
    "Code": 200
  }
}

Error codes

HTTP status code

Error code

Error message

Description

200 21002 模板预测超时
200 21003 模版预测失败
200 10001 参数出错
200 16001 未找到可预测的模型
200 13018 未找到模型信息
200 16004 指定模型不存在
200 23002 获取资源HTTP异常
200 11002 账号没有开通服务
200 19999 未知异常
200 50008 文件过大
200 50007 文件格式不支持
200 10005 服务不存在

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.