After you deploy a Qwak-based model, you can invoke inferences using a REST client to get inferences from the model hosted as a real-time endpoint.

Inference examples

The following example invokes the model test_model which accepts one feature vector which contains three fields and produces one output field named "score".

We'll use a curl command as a REST client.

Authentication

To generate predictions via a vanilla REST client, first generate a token to authenticate against the model. A token is temporary, valid for 24 hours only, and can be generated using the following command:

curl --location --request POST 'https://grpc.qwak.ai/api/v1/authentication/qwak-api-key' \
		 --header 'Content-Type: application/json' \
		 --data '{"qwakApiKey": "<API_Key>"}'

Where API_KEY is the Qwak-assigned API key provided during platform registration.

Inference

Once a token is generated, invoke the model as follows:

curl --location --request POST 'https://models.<environment_name>.qwak.ai/v1/test_model/predict' \
     --header 'Content-Type: application/json' \
	   --header 'Authorization: Bearer <Auth Token>' \
	   --data '{"columns":["feature_a","feature_b","feature_c"],"index":[0],"data":[["feautre_value",1,0.5]]}'

Inference for a specific variation

If you work with variation, you can create an inference to a specific variation (endpoint) by adding the variation name to the URL as follows:

curl --location --request POST 'https://models.<environment_name>.qwak.ai/v1/test_model/variation_name/predict' \
     --header 'Content-Type: application/json' \
	   --header 'Authorization: Bearer <Auth Token>' \
	   --data '{"columns":["feature_a","feature_b","feature_c"],"index":[0],"data":[["feautre_value",1,0.5]]}'