Building your private Cloud AI API.

Moses Olafenwa
DeepQuestAI
Published in
5 min readJun 1, 2019

Step-by-step tutorial on creating your private AI APIs on the cloud.

The quest to build smarter applications and software systems has never been as paramount as it is in this era, where emerging technologies like Artificial Intelligence becomes a major differentiating factor between digital products that win the market and those that emerge and vanish like a “whales tail”. With the powerful functionalities of AI to recognize human faces, locate and identify objects in pictures, translate human languages effectively, understood human speech and generate new ones, AI integration will be a must have feature for every app and software system by the start of the next decade.

Most developers do not have the theoretical and technical skill to easily integrate AI into their code base due to the complex and time-consuming learning curve. On the other hand, APIs on the cloud are the most developer friendly options to integrate advance features into their code base using any programming language of their choice. With a number of companies providing AI APIs on the cloud, most developers opt for integrating AI using the cloud.

In this article, we will show you how you can setup your own AI API on your private cloud server with:

  • Zero API cost, irrespective of the thousands or millions of request you make.
  • 100% data privacy.

DeepStack is a AI API server that provides state-of-the-art AI APIs such as Face Detection and Recognition, Persons and Object Detection, Scene Recognition and support for creating new APIs to recognize new set of objects using your custom Tensorflow, Keras and ONNX models. DeepStack is available for Windows, Linux, MacOS and Docker. With DeepStack installed on your local or cloud machine, you can easily integrate AI APIs into your apps and software at 98% the traditional cost and with 100% privacy.

We will be installing the Docker version on an Ubuntu server hosted on DigitalOcean. Please note that you can install DeepStack on any cloud computing platform that you use.

It is a 4-step process. Let’s get started.

Step 1 — Create an Ubuntu Server

Go to the DigitalOcean account dashboard , click the “Create” button on the top right and select “Droplets”.

Select “Ubuntu” as your droplet Image, select a pricing, select a data center and click the “Create” button at the bottom of the page.

Once the server is fully created and ready, DigitalOcean will send you an email with the root username and password to access your newly created Ubuntu server. Once you have the login details from your email, click on the 3-dots in front of the name of your Ubuntu server and select “Access Console”.

Once the console opens, enter your login details and follow the instructions to reset your Ubuntu server password.

Step 2 — Install DeepStack using Docker

Once your Ubuntu server is ready after the password reset, type and run the following commands in the console to install Docker and DeepStack.

sudo apt-get update
sudo apt-get install curl
curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
sudo docker pull deepquestai/deepstack

Please note that the first 3 commands is for installing Docker while the 4th is for installing DeepStack on your Ubuntu server through Docker. Once DeepStack is installed on your Ubuntu server, run the command below to start DeepStack with object detection API on.

sudo docker run -e VISION-DETECTION=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack

You will see the log above. Then visit your Ubuntu server’s IP address in the browser. You will see the interface shown below.

VOILA! Your private Cloud AI API server is now fully functional. See the next step on using your Cloud AI API.

Step 3— Test and Using your private Cloud AI API

Now that your private Cloud AI API server is setup, you can connect to your APIs via the IP Address of your Ubuntu server from any mobile, web and software code base using any programming language of your choice. In the example below, we have a sample codes that we will use to connect to our Cloud AI API and perform persons and object detection on a sample picture.

Sample Picture

Sample Python code

Sample NodeJS code

Sample C# code

- Detection Result -

Using the x_min, y_min, x_max and y_max coordinates of each objects in the JSON result, you can count all the objects, extract each object as a separate image or draw boxes around each object.

We have provided a comprehensive Dev Center with documentations and sample codes to fully utilize your private Cloud AI API. Visit the DeepStack Dev Center via the link below.

You can learn more about using DeepStack via the links below.

--

--

Moses Olafenwa
DeepQuestAI

Software Engineer @BabylonHealth, Prev. @Microsoft. A self-Taught computer programmer, Deep Learning, AI Engineer.