Building your private Cloud AI API.

Moses Olafenwa
Jun 1, 2019 · 5 min read

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

Image for post
Image for post

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”.

Image for post
Image for post

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

Image for post
Image for post
Image for post
Image for post

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”.

Image for post
Image for post

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

Image for post
Image for post
Image for post
Image for post

Step 2 — Install DeepStack using Docker

Image for post
Image for post

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
Image for post
Image for post

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

Image for post
Image for post

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

Image for post
Image for post

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.

Image for post
Image for post
Image for post
Image for post

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.

DeepQuestAI

Our Mission which we choose to accept is to advance and…

Moses Olafenwa

Written by

Software Engineer @Microsoft . A self-Taught computer programmer, Deep Learning, Computer Vision Researcher and Developer. http://olafenwamoses.me

DeepQuestAI

Our Mission which we choose to accept is to advance and democratize Artificial Intelligence and make it accessible to every individual and corporate entity of all sizes everywhere on the planet. https://www.deepquestai.com

Moses Olafenwa

Written by

Software Engineer @Microsoft . A self-Taught computer programmer, Deep Learning, Computer Vision Researcher and Developer. http://olafenwamoses.me

DeepQuestAI

Our Mission which we choose to accept is to advance and democratize Artificial Intelligence and make it accessible to every individual and corporate entity of all sizes everywhere on the planet. https://www.deepquestai.com

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store