How to do it...

The code for this recipe takes an image file and verifies whether the image has a face and that it isn't a spoofed image. It makes two calls to the Vision API to determine this:

  1. After cloning the source code of the book, navigate to the Chapter20/vision-api folder.

 

  1. To execute the program in an isolated environment, create a virtualenv and install the dependent packages:
$ virtualenv ENV$ source ENV/bin/activate$ pip install -r requirements.txt

The following is the contents of the requirements.txt file:

google-cloud-storage==1.7.0google-cloud-vision==0.30.0Pillow==5.0.0
  1. The following is the program which invokes the Vision API:
  1. The client libraries are imported. We'll use the Python Imaging Library (PIL) to pass images ...

Get Building Google Cloud Platform Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.