CreateModelAsyncPredict

更新时间:
复制 MD 格式

Creates an asynchronous prediction task for document self-learning.

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:CreateModelAsyncPredict

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ModelVersion

string

No

The model version. If unspecified, the latest active version is used.

V1

BinaryToText

boolean

No

Specifies the document source. Set to true if providing the document's base64-encoded content in the Body parameter, or false if providing the document's URL in the Content parameter.

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

Content

string

No

The URL of the image or PDF file for analysis.

https://doc-automl-public.oss-cn-hangzhou.aliyuncs.com/3/1559855998794593/stage/upload/20230206/oss-hlfCRJ1SorSWs10MkqxK6YcL4OVAFSv4.png?Expires=1675665563&OSSAccessKeyId=XXXX&Signature=WLKghBc3zKzWJ3Td69%2B4C21jrbE%3D

ModelId

integer

No

The model ID. You can find this ID on the Model List Page.

123

ServiceName

string

No

The name of the pre-trained service.

pre_train_service

ServiceVersion

string

No

The version of the pre-trained service.

V1

Body

string

No

The base64-encoded content of the document.

data:image/png;base64,xxxxx

The BinaryToText parameter is optional.

You must specify either the Content parameter for a document URL or the Body parameter for base64-encoded content. When using Body, set BinaryToText to true.

PDF documents are limited to 20 MB and 10 pages. All prediction services process only the first page, except for those designed for long documents.

Response elements

Element

Type

Description

Example

object

The response object.

RequestId

string

The request ID.

3EAC98E6-8DD6-511F-8764-DEE8B6EB6BB4

Code

integer

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

200

Message

string

The response message. Returns "success" if the request is successful, or an error message if it fails.

success

Data

string

The response data, formatted as a JSON string. For details, see the sample response.

{ "RequestId": "292D1584-134C-1221-B9BB-1B847C623D41", "Message": "", "Data": 1, "Code": 200 }

The Data parameter returns a JSON string representing a nested response. Parse this string to retrieve the value from its inner Data field, which contains the asynchronous task ID. You can then pass this ID to the GetModelAsyncPredict operation to retrieve the prediction results.

Examples

Success response

JSON format

{
  "RequestId": "3EAC98E6-8DD6-511F-8764-DEE8B6EB6BB4",
  "Code": 200,
  "Message": "success",
  "Data": "{\n  \"RequestId\": \"292D1584-134C-1221-B9BB-1B847C623D41\",\n  \"Message\": \"\",\n  \"Data\": 1,\n  \"Code\": 200\n}"
}

Error codes

HTTP status code

Error code

Error message

Description

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

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.