Getting Predictions for Visual AI Projects via API Calls
You can find the latest information for using the API in the DataRobot public documentation. Also, click ? in-app to access the full platform documentation for your version of DataRobot.
(Article updated March 2021)
This article explains how to make predictions on Visual AI projects via API calls. Please read through this community blog post if you need guidance on how to prepare your image data to start a Visual AI project on DataRobot.
To make predictions via API calls, you first need to convert your images to the base64 format. That is the standard way to handle images via API calls. (Please find an example script here if you need help with the base64 conversion step.)
Below is an example of the input file structure, command code (using the Python script linked above) and the output file value after the conversion.
After a model is trained and deployed, you will be able to find the Prediction API Scripting Code under the Deployments menu. Select the deployment you created (e.g., Plant Disease Detection in this example) and then click the Predictions tab. Click Prediction API and select "Batch" (Prediction Type) and "API Client" (Interface).
You can copy the code and save it as a Python script. You may want to edit the script to incorporate additional steps. For example, add the passthrough_columns_set argument to BatchPredictionJob if you would like to include columns from the input file (such as image id) to the output file. For more information on the scoring code, please refer to the DataRobot Python Client Documentation.
With the scoring script and base64 converted file, you will be able to make an API call to get the predictions. For the multiclass classification problem in this example, the prediction file will include the probability of the image falling under each class, the class name with the highest probability, and all the other optional columns requested from the scoring script (such as prediction_status and image id).
Make sure to check the DataRobot Commuity GitHub for some data prep tools, including a script to help with the base64 conversion process.