Skip to content

Predicting online with a deployed model

This section shows you how to make predictions by a deployed model for new data on the AI & Analytics Engine via

  • Using the GUI
  • Using API access through SDK

Using the GUI

The method of online prediction is via the summary page of a model and usage of the API Test. To use the API test, you paste CSV data in the left column (without header and target column) and click on the "CALL API" button and observe the sample output.

API Test Example data feed

Using API access through SDK

To access the API functions, you need to first authenticate into the platform by the following

from aiaengine import api

client = api.Client()

Import modules

Then you need to import the following modules required in the next steps.

import requests

from aiaengine.api import app

Get endpoint URL of the deployed model

In order to use a deployed model for prediction, you need to get the endpoint URL (see an example below) once the model deployment becomes active.

get_deployment_response = client.apps.GetDeployment(

assert get_deployment_response.status == 'active'

get_endpoint_response = client.apps.GetEndpoint(

endpoint_url = get_endpoint_response.url

>>> ''

Save evaluation results of predicted data into a file

Now you can make predictions on new data using endpoint_url. See our example below

with open('./path/to/new_data.csv') as file:
    data_for_prediction = file.readlines()

response =
    endpoint_url + '/invocations',
    headers={'Content-Type': 'text/csv'}

assert response.status_code == 200

with open('./path/to/new_data_prediction.jsonl', 'w') as file: