Testing a Service
After a model is deployed as a real-time service, you can debug code or add files for testing on the Prediction tab page. Based on the input request (JSON text or file) defined by the model, the service can be tested in either of the following ways:
- JSON Text Prediction: If the input type of the model of the deployed service is JSON text, that is, the input does not contain files, you can enter the JSON code on the Prediction tab page for service testing.
- File Prediction (Images and Audios): If the input type of the model of the deployed service is file, including images, audios, and videos, you can add images on the Prediction tab page for service testing.
If the input type is image, the size of a single image must be less than 10 MB.
Input Parameters
For the service that you have deployed, you can learn about its input parameters of the service, that is, the input request type mentioned above, on the Usage Guides tab page of the service details page.
The input parameters displayed on the Usage Guides tab page depend on the model source that you select.
- If your model comes from ExeML or a built-in algorithm, the input and output parameters are defined by ModelArts. For details, see the Usage Guides tab page. On the Prediction tab page, enter the corresponding JSON text or file for service testing.
- If you use a custom model, that is, the inference code and the configuration file are compiled by yourself (Specifications for Compiling the Model Configuration File), the Usage Guides tab page only visualizes your configuration files. The following figure shows the mapping between the input parameters displayed on the Usage Guides tab page and the configuration file.
Figure 2 Mapping between the configuration file and Usage Guides
- If your model is imported using a model template, the input and output parameters vary with the template. For details, see the description in Model Template Overview.
JSON Text Prediction
- Log in to the ModelArts management console and choose Service Deployment > Real-Time Services.
- On the Real-Time Services page, click the name of the target service. The service details page is displayed. On the Prediction tab page, enter the prediction code and click Predict to perform prediction. In Figure 3, attr_7 indicates the target column, and predictioncol indicates the prediction result of the target column attr_7.
For details about the JSON text prediction code and return result, see Bank Deposit Prediction. This example is a model trained using ExeML. The input type is officially defined by ModelArts and cannot be changed. For details about how to use a custom model, see Vehicle Satisfaction Survey.
The value of attr_7 can be set to any value or left blank, which does not affect the prediction result.
File Prediction (Images and Audios)
- Log in to the ModelArts management console and choose Service Deployment > Real-Time Services.
- On the Real-Time Services page, click the name of the target service. The service details page is displayed. On the Prediction tab page, click Upload and select a test file. After the file is uploaded successfully, click Predict to perform a prediction test. In Figure 4, the label, position coordinates, and confidence score are displayed.
For details about the file prediction code and return result, see Flower Recognition. This example is a model trained using the built-in algorithm. The input type is officially defined by ModelArts and cannot be changed. For details about how to use a custom model, see Handwritten Digit Recognition.
Last Article: Viewing Service Details
Next Article: Accessing a Real-Time Service (Token-based Authentication)


Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.