PredictPreTrainModel

Updated at:

Provides preset capability predictions. Currently available: UIE extraction, applicable to general-purpose intelligent 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 prediction content in JSON string format. UIE extraction parameter format: {"query":"xxx","schema":["field1","field2"]}. query corresponds to the image URL, and schema corresponds to the array of fields to extract.

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

ServiceVersion

string

No

The version of the preset capability service. Default value: V1.

V1

ServiceName

string

No

The service name of the preset capability service. This parameter is required. For UIE extraction, set this parameter to "FormUIE".

FormUIE

BinaryToText

boolean

No

Set to false when the Content field contains an image URL. Set to true when the Body field contains a Base64-encoded image.

false

Body

string

No

The prediction content when passing a Base64-encoded image, in JSON character string format. UIE extraction parameter format: {"query":"xxx","schema":["field1","field2"]}. query corresponds to the Base64 encoding of the image, and schema corresponds to the array of fields to extract.

{"query":"data:image/png;base64,xxxxx","schema":["Name", "Address"]}

BinaryToText is optional.

Specify either the Content field or the Body field. If the image content is a URL, pass the Content field. If the image content is Base64-encoded, pass the Body field and set BinaryToText to true.

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

Id of the request

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

Code

integer

The status of the request result. A value of 200 indicates success.

200

Message

string

The error message.

success

Data

object

The response data returned by the operation.

{ "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": "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": "Address", "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 prediction response of the preset capability service. The Data field is described as follows:
score The confidence score of the prediction service, ranging from 0 to 1.
data The prediction results returned by the algorithm, in array format.
prob The confidence score of the algorithm result, ranging from 0 to 1.
name The extraction key.
fieldWord The extraction value.
location The coordinate position of the extraction result. {"x": 119, "y": 48} represents a coordinate point on the page.
wordInfo The detailed information of the extracted content, including the position information of each character.
specificType The algorithm type (formuie-anti: UIE extraction).
classType preDefinedServer: preset capability.
predictFile The URL of the prediction file (expires after 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": "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": "Address",
          "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.