Accessing an Edge Service
Accessing an Edge Service
If the edge service and edge node are in the Running status, the edge service has been successfully deployed on the edge node.
You can use either of the following methods to send an inference request to the edge service deployed on the edge node in a network that can access the edge node:
Method 1: Use GUI-based Software for Inference (Postman)
- Download Postman and install it, or directly add the Postman extension to Google Chrome. (Alternatively, use other software that can send POST requests).
- Open Postman. Figure 1 shows the Postman interface.
- Set parameters on Postman. The following uses image classification as an example.
- Select a POST task, and copy the URL of the edge node to the POST edit box. View the URL of the edge node on the Node Info tab page of the edge service details page.
Figure 2 POST parameter settings
- On the Body tab page, input parameters are divided into file input and text input types.
- File input
Select form-data. Set KEY to the input parameter of the model, for example, images. Set VALUE to an image to be inferred (currently, only one image can be inferred).
Figure 3 Entering Body configuration information
- Text input
Select raw and then select JSON(application/json). Enter the request body in the text box below. An example request body is as follows:
{ "meta": { "uuid": "10eb0091-887f-4839-9929-cbc884f1e20e" }, "data": { "req_data": [ { "sepal_length": 3, "sepal_width": 1, "petal_length": 2.2, "petal_width": 4 } ] } }meta can carry uuid. When the inference result is returned, uuid is returned to trace the request. If you do not need this function, leave meta blank. data contains the req_data array. You can pass one or more pieces of request data. The parameters of each piece of data are determined by the model, such as sepal_length and sepal_width in this example.
- File input
- Select a POST task, and copy the URL of the edge node to the POST edit box. View the URL of the edge node on the Node Info tab page of the edge service details page.
- After setting the parameters, click Send to send the request. The result is displayed in the response.
- Figure 4 shows an example of the inference result using file input.In the inference result using file input, the field values may vary with the model.
- Figure 5 shows an example of the inference result using text input. The request body of inference using text input contains meta and data. If the request contains uuid, uuid will be returned in the response. Otherwise, uuid is left blank. data contains the req_data array. You can pass one or more pieces of request data. The parameters of each piece of data are determined by the model, such as sepal_length and sepal_width in this example.
Method 2: Run the cURL Command to Send an Inference Request
- File input
curl -F 'images=@Image path'-X POST Service address of the edge node
- -F indicates file input. In this example, the parameter name is images, which can be changed as required. The image storage path follows @.
- POST is followed by the URL of the edge node.
The following is an example of the cURL command for inference with file input:curl -F 'images=@/home/data/cat.jpg' -X POST https://192.168.0.158:1032
Figure 6 shows the inference result.
- Text input
curl -d '{ "meta": { "uuid": "10eb0091-887f-4839-9929-cbc884f1e20e" }, "data": { "req_data": [ { "sepal_length": 3, "sepal_width": 1, "petal_length": 2.2, "petal_width": 4 } ] } } '-X POST <Service address of the edge node>- -d indicates the text input of the request body. If the model uses text input, this parameter is mandatory.
The following is an example of the cURL command for inference with text input:
curl -d '{ "meta": { "uuid": "10eb0091-887f-4839-9929-cbc884f1e20e" }, "data": { "req_data": [ { "sepal_length": 3, "sepal_width": 1, "petal_length": 2.2, "petal_width": 4 } ] } }' -X POST http://192.168.0.158:1033Figure 7 shows the inference result.
Last Article: Deploying a Model as an Edge Service
Next Article: Modifying a Service





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