seldon-core icon indicating copy to clipboard operation
seldon-core copied to clipboard

Running test model on seldon core

Open krishna-dahifale opened this issue 8 years ago • 3 comments

We are referring( https://github.com/SeldonIO/seldon-core/blob/master/notebooks/kubectl_demo_gcp.ipynb)
we have reached at stage Normal Operation Create Seldon Deployment
While running project: "FX Market Prediction" we are not able to recognize ,which input parameter we have to provide and how to proceed further.

krishna-dahifale avatar Feb 14 '18 09:02 krishna-dahifale

Hi Krishna,

Do you mean that you do not know the format of the data you need to send to the model to get predictions?

Maximophone avatar Feb 14 '18 10:02 Maximophone

Hi, Thanks for quick reply, Yes I want to know what input parameter need to send.which is of json content-type, if i am not wrong.

krishna-dahifale avatar Feb 14 '18 11:02 krishna-dahifale

This demo is more of an illustration of the process of deploying a model so it does not do a very good job of highlighting the actual requests that are sent to the model.

It happens in the following python function:

def rest_request():
    token = get_token()
    headers = {'Authorization': 'Bearer '+token}
    payload = {"data":{"names":["a","b"],"tensor":{"shape":[2,2],"values":[0,0,1,1]}}}
    response = requests.post(
                "http://{}:8080/api/v0.1/predictions".format(SELDON_API_IP),
                headers=headers,
                json=payload)
    print response.text

The format of the request is

{
  "data":{
    "names":["a","b"],
    "tensor":{
      "shape":[2,2],
      "values":[0,0,1,1]}
    }
}

In this case we chose to use a tensor to hold the data. It comes with a shape and a unidimensional list of values. The first dimension of the shape corresponds to the number of predictions you want (size of the batch). The second dimension corresponds to the number of features. Here we are also giving names to the features ("a" and "b").

The API is defined in the protobuf format here, and documented here

Maximophone avatar Feb 14 '18 11:02 Maximophone