Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Deep Learning Projects

You're reading from   Python Deep Learning Projects 9 projects demystifying neural network and deep learning models for building intelligent systems

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781788997096
Length 472 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
Rahul Kumar Rahul Kumar
Author Profile Icon Rahul Kumar
Rahul Kumar
Matthew Lamons Matthew Lamons
Author Profile Icon Matthew Lamons
Matthew Lamons
Abhishek Nagaraja Abhishek Nagaraja
Author Profile Icon Abhishek Nagaraja
Abhishek Nagaraja
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Building Deep Learning Environments FREE CHAPTER 2. Training NN for Prediction Using Regression 3. Word Representation Using word2vec 4. Building an NLP Pipeline for Building Chatbots 5. Sequence-to-Sequence Models for Building Chatbots 6. Generative Language Model for Content Creation 7. Building Speech Recognition with DeepSpeech2 8. Handwritten Digits Classification Using ConvNets 9. Object Detection Using OpenCV and TensorFlow 10. Building Face Recognition Using FaceNet 11. Automated Image Captioning 12. Pose Estimation on 3D models Using ConvNets 13. Image Translation Using GANs for Style Transfer 14. Develop an Autonomous Agent with Deep R Learning 15. Summary and Next Steps in Your Deep Learning Career 16. Other Books You May Enjoy

Cloud platforms for deployment

The main idea behind this book is to empower you to build and deploy DL applications. In this section, we will discuss some critical components required to make your applications accessible to millions of users.

The best way to make your application accessible is to expose it as a web service, using REST or SOAP APIs. To do so, we have many Python web frameworks to choose from, such as web.py, Flask, Bottle, and many more. These frameworks allow us to easily build web services and deploy them.

Prerequisites

You should have a Google Cloud (https://cloud.google.com/) account. Google is promoting the usage of its platform right now, and is giving away $300 dollars of credit and 12 months as a free tier user.

Setting up the GCP

Follow these instructions to set up your GCP:

  1. Creating a new project: Click on the three dots, as shown in the following screenshot, and then click on the + sign to create a new project:

  1. Spinning a VM instance: Click on the three lines on the upper-left corner of the screen, select the compute option, and click on Compute Engine. Now choose Create new instance. Name the VM instance, and select your zone as us-west2b. Choose the machine type size.

    Choose your boot disk as Ubuntu 16.04 LTS. In firewall options, choose both the http and https option (it's important to make it accessible from the outer world). To opt for GPU options, you can click on customize button, and find the GPU options. You can choose between two NVIDIA GPUs. Check both Allow HTTP traffic and Allow HTTPS traffic.

    Now click on Create. Boom! your new VM is getting ready.

  2. Modify the firewall settings: Now click on the Firewall rules setting under Networking. Under Protocols and Ports, we need to select the port that we will use to export our APIs. We have chosen tcp:8080 as our port number. Now click on the Save button. This will assign a rule in the firewall of your VM to access the applications from the external world.

  3. Boot your VM: Now start your VM instance. When you see the green tick, click on SSH—this will open a command window, and you are now inside the VM. You can also use gcloud cli to log in and access your VMs.

  4. Then follow the same steps as we performed to set up the local environment, or read further to learn how to create an automation script that will perform all the setup automatically.

Now we need a web framework to write our DL applications as web services—again, there are lots of options, but to make it simple, we will be using a combination of web.py and Gunicorn.

If you want to know which web framework to choose based on memory consumption, CPU utilization, and so on, you can have a look at the comprehensive list of benchmarks at http://klen.github.io/py-frameworks-bench.

Let's install them using following commands:

pip install web.py
pip install gunicorn

Now we are ready to deploy our DL solution as a web service, and scale it to production level.

You have been reading a chapter from
Python Deep Learning Projects
Published in: Oct 2018
Publisher: Packt
ISBN-13: 9781788997096
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image