Use deployed model from the command line with CURL

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.

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:

 -F “Image=@my_image.png”

Before you try remember to check the limitations stated in Deploy to API limitations.

Test curl method with a deployed mnist model

We’ve used the MNIST tutorial Deploy an operational AI model to build and deploy a model so you can test this implementation.

Download image

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:"


The predicted result is '6'! ‘6’ gets the highest value, 0.9996182. This means that the model predicts the image to be a ‘6’.

Results of number 6 prediction
Try the platform