Prediction APIs

Endpoint Format

Follow the seldon document.

The format is http(s)://${primehub_domain}/deployment/${deployment_id}/api/v1.0/predictions.

Payload Message Format

Please check Github for more detail.

ndarray

Format

curl -X POST http(s)://${endpoint} \
    -H 'Content-Type: application/json' \
    -d '{ "data": {"ndarray": [[5.964,4.006,2.081,1.031]]} }'

Equivalent Code

X = np.array([[5.964,4.006,2.081,1.031]])

tensor

Format

curl -X POST http(s)://${endpoint} \
    -H 'Content-Type: application/json' \
    -d '{ "data": {"tensor": {"shape":[1,4],"values":[5.964,4.006,2.081,1.031]}} }'

Equivalent Code

X = np.array([5.964,4.006,2.081,1.031]).reshape([1,4])

strData

Format

curl -X POST http(s)://${endpoint} \
    -H 'Content-Type: application/json' \
    -d '{ "strData": "any string" }'

Equivalent Code

X = "any string"

binData

Format

curl -X POST http(s)://${endpoint} \
    -F 'binData=@your_image.jpg'

Equivalent Code

X = bytes(<content of your_image.jpg>)

Check our example of how to handle the binData in the predict function.

Last updated