Reader small image

You're reading from  Hands-On Python Deep Learning for the Web

Product typeBook
Published inMay 2020
Reading LevelBeginner
PublisherPackt
ISBN-139781789956085
Edition1st Edition
Languages
Right arrow
Authors (2):
Anubhav Singh
Anubhav Singh
author image
Anubhav Singh

Anubhav Singh, a web developer since before Bootstrap was launched, is an explorer of technologies, often pulling off crazy combinations of uncommon tech. An international rank holder in the Cyber Olympiad, he started off by developing his own social network and search engine as his first projects at the age of 15, which stood among the top 500 websites of India during their operational years. He's continuously developing software for the community in domains with roads less walked on. You can often catch him guiding students on how to approach ML or the web, or both together. He's also the founder of The Code Foundation, an AI-focused start-up. Anubhav is a Venkat Panchapakesan Memorial Scholarship awardee and an Intel Software Innovator.
Read more about Anubhav Singh

Sayak Paul
Sayak Paul
author image
Sayak Paul

Sayak Paul is currently with PyImageSearch, where he applies deep learning to solve real-world problems in computer vision and bring solutions to edge devices. He is responsible for providing Q&A support to PyImageSearch readers. His areas of interest include computer vision, generative modeling, and more. Previously at DataCamp, Sayak developed projects and practice pools. Prior to DataCamp, Sayak worked at TCS Research and Innovation (TRDDC) on data privacy. There, he was a part of TCS's critically acclaimed GDPR solution called Crystal Ball. Outside of work, Sayak loves to write technical articles and speak at developer meetups and conferences.
Read more about Sayak Paul

View More author details
Right arrow

Deep Learning on Google Cloud Platform Using Python

In the previous chapter, we saw a variety of deep learning APIs that are provided by various organizations. We also saw their applicability broadly grouped into two categories—the first was computer vision and image processing, and the second was natural language processing. We are going to continue exploring deep learning APIs in this chapter as well. This chapter introduces you to Google Cloud Platform (GCP) and three APIs offered by it in the area of deep learning.

In this chapter, we will cover the following topics:

  • Setting up your GCP account
  • Creating your first project on GCP
  • Using the Dialogflow API in Python
  • Using the Cloud Vision API in Python
  • Using the Cloud Translation API in Python

Technical requirements

Setting up your GCP account

Before we proceed with using the APIs offered by GCP, you must set up your GCP account. Assuming that you already have a Google account—first, head to https://cloud.google.com/. GCP gives you $300 of credit (which you can use for a period of 12 months) if you are signing up to it for the first time; this credit is sufficient enough to accommodate many good projects and enable you to try out the offerings of GCP. Once this has been done, we can follow these steps:

  1. At the top-right corner of GCP's home page, you should be able to locate a Try free button. Just click on it:

  1. If you are not signed in to your Google account, you will be asked to sign in. Select your country accordingly and make sure you check the Terms of service box. After this, click on AGREE AND CONTINUE. You will see a page as in the following screenshot:

  1. Then, you...

Creating your first project on GCP

A project helps you organize all your GCP resources systematically. Creating a project on GCP can be done in just a matter of a few clicks:

  1. After signing in to your Google account, open up your GCP console using https://console.cloud.google.com. In the top-left corner, you should see Google Cloud Platform and just beside that, you can see a drop-down list, as shown:

  1. If you did create any projects while signing up for GCP or previously, then one of your projects will appear in the marked area (fast-ai-exploration and gcp-api are two projects that I created on GCP). Now, click on the down arrow and a popup should appear:

  1. Click on NEW PROJECT to proceed. You should end up on a page, shown in the following screenshot, that will ask you to specify the project's name. GCP automatically generates an ID for the project that you are creating...

Using the Dialogflow API in Python

Before we start to learn how to use the Dialogflow API in Python, let's understand what Dialogflow is all about.

Dialogflow (formerly known as api.ai) provides a suite of utilities for building natural and rich conversational interfaces, such as voice assistants and chatbots. It is powered by deep learning and natural language processing and is used by a large number of companies. It seamlessly integrates with websites, mobile applications, and many popular platforms, such as Facebook Messenger, Amazon Alexa, and so on. Dialogflow provides us with three major components for building a conversational user interface:

  • The best practices and processes that can easily be applied to any conversational user interface
  • Functionalities to add any custom logic that might be required for building a conversational user interface
  • Facilities to train...

Using the Cloud Vision API in Python

Computer vision is the field of making computers understand images and make sense of them. Common computer vision tasks include image classification, image detection, image segmentation, and so on. As discussed in earlier chapters, the field of computer vision has been heavily affected by the effectiveness of deep learning in achieving human-level (and sometimes even better) performance.

The Cloud Vision API provides us with a lot of utilities for performing computer vision tasks. Cloud Vision allows us to use the pre-trained models as well as build our own custom production-ready models that cater to our needs (such as AutoML Vision Beta). Let's now briefly look at the features that are offered by the Cloud Vision API:

  • Label detection
  • Optical character recognition
  • Handwriting recognition
  • Landmark detection
  • Object localization
  • Image search...

Using the Cloud Translation API in Python

The Cloud Translation API helps developers to easily integrate language translation functionalities into their applications. It is powered by state-of-the-art neural machine translation, which can be thought of as an amalgamation of deep learning and machine translation. The Cloud Translation API provides programmatic interfaces for using pre-trained models and building production-ready custom models.

Many developers use the Cloud Translation API's pre-trained models to dynamically translate a given set of text into a target language. The Cloud Translate API supports more than 100 languages. But this language library is evolving to empower the developer community. The following screenshot shows a translation of some text written in English to Bengali:

You can always try this on https://cloud.google.com/translate/. But sometimes,...

Summary

In this chapter, we explored some of the famous and groundbreaking deep learning-based services provided by GCP. We learned how to use Dialogflow using Python to build conversational chatbots that can learn over time. We used the Cloud Vision API to predict the objects recognized in any image. We could easily extrapolate this to a video and achieve similar results. We finally covered the Cloud Translate API for performing deep NLP-based translation using the service. All the major services provided by GCP are accessible over APIs, which makes them easily replaceable in any project. The accuracy of models created by highly trained professionals is commendable and makes the life of a web developer easier when trying to build AI-powered web solutions.

In the next chapter, we will introduce the features offered by Amazon Web Services (AWS) to integrate AI with web applications...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Python Deep Learning for the Web
Published in: May 2020Publisher: PacktISBN-13: 9781789956085
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.
undefined
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 $15.99/month. Cancel anytime

Authors (2)

author image
Anubhav Singh

Anubhav Singh, a web developer since before Bootstrap was launched, is an explorer of technologies, often pulling off crazy combinations of uncommon tech. An international rank holder in the Cyber Olympiad, he started off by developing his own social network and search engine as his first projects at the age of 15, which stood among the top 500 websites of India during their operational years. He's continuously developing software for the community in domains with roads less walked on. You can often catch him guiding students on how to approach ML or the web, or both together. He's also the founder of The Code Foundation, an AI-focused start-up. Anubhav is a Venkat Panchapakesan Memorial Scholarship awardee and an Intel Software Innovator.
Read more about Anubhav Singh

author image
Sayak Paul

Sayak Paul is currently with PyImageSearch, where he applies deep learning to solve real-world problems in computer vision and bring solutions to edge devices. He is responsible for providing Q&A support to PyImageSearch readers. His areas of interest include computer vision, generative modeling, and more. Previously at DataCamp, Sayak developed projects and practice pools. Prior to DataCamp, Sayak worked at TCS Research and Innovation (TRDDC) on data privacy. There, he was a part of TCS's critically acclaimed GDPR solution called Crystal Ball. Outside of work, Sayak loves to write technical articles and speak at developer meetups and conferences.
Read more about Sayak Paul