The CURL-example in the Deployment view is a good way to test out the deployment functionality. Select CURL and expose the information and example code needed to send requests to the model using a REST API.
Substitute VALUE with an actual input value
For the code to work you need to substitute VALUE with an actual input value.
If the input feature is an image, you also have to precede the replaced VALUE with an “@” character.
|If you want to post a file, remember that curl uses the "@"-prefix, e.g., -F “Image=@my_image.png”|
Example: If you want to classify an image called my_image.png in the current working directory, you will write on the second line in the CURL input example:
Before you try, remember to check the limitations stated in Deploy to API limitations.
We’ve used the MNIST tutorial Deploy an operational AI model to build and deploy a model so you can test this implementation.
Download this image and store it in a folder on your computer. Name the image Number_6.png.
Copy-paste CURL example
Then copy-paste this CURL input example in your terminal. It’s the same code as in the screenshot above but we’ve substituted VALUE with @Number_6.png.
curl -X POST -F "Image=@Number_6.png" -u "908453eb-8aed-4947-8d01-6a4923b366eb:" https://a.peltarion.com/deployment/886e41a5-8801-4e76-ae0e-19159a5e9023/forward
The predicted result is '6'! ‘6’ gets the highest value, 0.9996182. This means that the model predicts the image to be a ‘6’.
Make sure the input parameters of the request match the expected format and type in order to get a successful prediction. Adjust the parameters naming if needed for the service calls.