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. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot