Python Runtime SDK

After you deploy a Qwak-based model, your Python-based client applications can use this module to get inferences from the model hosted as a real-time endpoint.

Installation

The Python inference clients is a more lightweight part of qwak-inference SDK which contains only the modules that are required for inference. To install, run:

pip install qwak-inference

Inference Example

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

from qwak_inference import RealTimeClient

model_id = "test_model"
feature_vector = [
   {
      "feature_a": "feature_value",
      "feature_b": 1,
      "feature_c": 0.5
   }]

client = RealTimeClient(model_id=model_id, environment=environment_name)
response = client.predict(feature_vector)

Inference for a specific deployment variation:

from qwak_inference import RealTimeClient

model_id = "test_model"
feature_vector = [
   {
      "feature_a": "feature_value",
      "feature_b": 1,
      "feature_c": 0.5
   }]

client = RealtimeClient(model_id=model_id, environment=environment_name, variation="variation_name")
response = client.predict(feature_vector)