Inference Request URI

  • The URI path of the inference service can contain only letters, digits, and special characters (+, -, _, and /). The URI path length range is [3, 255]. URIs that do not meet the preceding conditions will be identified as invalid URIs. And the server returns an error code indicating an invalid URI to the client.
  • Do not add parameters or invalid characters to the URI. Otherwise, the URI may be regarded as an invalid URL and returned to the client.
  • Do not write sensitive information to the URI.
  • OPTIONS and HEAD requests are supported, both of which can use the functions supported by the Flask framework by default.
  • Inference request API for an inference stream: POST v2/streams/${STREAM_NAME}/infer,

    in which ${STREAM_NAME} indicates the inference stream name.

  • Request API for single-model inference: POST v2/models/${MODEL_NAME}/infer,

    in which ${MODEL_NAME} indicates the model name.

    The request body of an inference request must contain inputs, whose value must be a list. For details, see the JSON field of an inference request in Request Configuration Items. For details about the tensor corresponding to inputs, see Tensor configuration items in Inference Configuration Items. The last parameter data in the table must be set for an inference request.

    For details about the inference response, see the JSON field in an inference response in Request Configuration Items. The following table describes the parameters.

    Table 1 Inference request response fields

    Field Name

    Description

    Data Type

    isSuccess

    Whether the inference is successful

    Boolean

    errorCode

    Error code

    Integer

    errorMsg

    Error message

    String

    outputs

    Output tensor

    Tensor

    • ${MODEL_NAME} and ${STREAM_NAME} must be character strings, which consist of letters, digits, and special characters (+-_).
    • For POST requests, content_type must be set to application/json.