Testing an Inference Service
A real-time service supports files, images, and JSON data for test. Deploy a real-time service predictor for the inference test.
Sample Code
In ModelArts notebook, you do not need to enter authentication parameters for session authentication. For details about session authentication of other development environments, see Session Authentication.
1 2 3 4 5 6 7 |
from modelarts.session import Session
from modelarts.model import Predictor
session = Session()
predictor_instance = Predictor(session, service_id="your_service_id")
predict_result = predictor_instance.predict(data=data_path, data_type=data_type)
print(predict_result)
|
Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
data_type |
Yes |
String |
The following types are supported: files, images, and JSON. |
|
data |
Yes |
String |
|
|
path |
No |
String |
Internal inference path, which defaults to "/" |
|
Parameter |
Description |
|---|---|
|
Response body |
Output parameters and values. The platform only forwards the output parameters and values, but does not recognize them. |
Last Article: Obtaining Details About a Service
Next Article: Obtaining Services
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.