Running your CV API on EC2


Postman is an extremely useful app used to test APIs. We'll be using it to demonstrate our CV API


Step 1: Install Postman

Windows/Mac Users - https://www.getpostman.com/downloads/

Ubuntu - Open Ubuntu Software, search for Postman and install


Step 2: Setting up Postman for testing your EC2 API

Using Postman (see image above and the corresponding numbered steps below:

  1. Change the protocol to POST

  2. Enter the Public IP Address of your EC2 Instance: http://18.224.96.38

  3. Change Tab to Body

  4. Select the form-data radio button

  5. From the drop down, select Key type to be file

  6. For Value, select one of our test images

  7. Click send to send our image to our API

  8. Our response will be shown in the window below.

The output is JSON file containing:

{
    "MainColor": "Red",
    "catOrDog": "Cat"
}

The cool thing about using Postman is that we can generate the code to call this API in several different languages:

See blue box to bring up the code box:

Code Generator

Note: To keep our API running constantly launch the python code using this instead:

sudo nohup python3 forms.py & screen


Conclusion


So you've just successfully deployed a Computer Vision Web App and API that can be used by users anywhere in the world! This facilitates many possibilities from developing Mobile Apps, startup products and research tools. However, it should be noted there are many improvements that can be made: