呼叫預測(Predict) API 取得 Model 的預測結果
語法
POST http://host:port/v1/models/${MODEL_NAME}[/versions/${VERSION}|/labels/${LABEL}]:predict
API 呼叫範例
curl -d '{"instances": [1.0,2.0,5.0]}' -X POST http://localhost:8501/v1/models/saved_model_half_plus_three:predict
Request 參數語法格式
{
// (Optional) Serving signature to use.
// If unspecifed default serving signature is used.
"signature_name": <string>,
// Input Tensors in row ("instances") or columnar ("inputs") format.
// A request can have either of them but NOT both.
"instances": <value>|<(nested)list>|<list-of-objects>
"inputs": <value>|<(nested)list>|<object>
}
Request 範例
{
// List of 3 scalar tensors.
"instances": [ "foo", "bar", "baz" ]
}
{
// List of 2 tensors each of [1, 2] shape
"instances": [ [[1, 2]], [[3, 4]] ]
}
Response 語法格式
{
"predictions": <value>|<(nested)list>|<list-of-objects>
}
{
"outputs": <value>|<(nested)list>|<object>
}
Response 範例
{
"predictions": [3.5, 4.0, 5.5]
}
- Classification: 分類
- Regression:回歸
- Predict:預測