Request Configuration Items

  1. The following is an example of the JSON field of an inference request. Configure the field based on the actual model or pipeline configuration file. In the example, the input data type is BINARY and the input format is FORMAT_NONE. The binary_data field indicates the binary image data read by the client.
    {
        "inputs": [{
            "name": "appsrc0",
            "id": 0,
            "dataType": "BINARY",
            "format": "FORMAT_NONE",
            "shape": [len(binary_data)],   
            "data": base64.b64encode(binary_data).decode()
        }]
    }
  2. The following is an example of the JSON field of an inference response. In this example, the data output format is STRING. result indicates the binary output returned by the server, and the value -1 indicates a variable dimension. data is the Base64-encoded inference result string.
    {
        "isSuccess": true,
        "errorCode": 0,
        "errorMsg": "Succeeded!",
        "outputs": [{
            "name": "appsink0",
            "dataType": "STRING",
            "format": "FORMAT_NONE",
            "shape": [len(result)],    
            "data": base64.b64encode(result).decode()
        }]
    }