Skip to content

allanbian1017/serverless-cloudvision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverless-cloudvision

This project is a serverless API wrapper around Google Cloud Vision using Google Cloud Function. Deployment is performed with the Serverless Framework.

Setup

Before you start, you need to setup Google Cloud credential by following the instructions here. And replace the projectid with your Google Cloud project id in serverless.yml.

In order to access the Cloud Vision API, you will need to enable Cloud Vision API in your project.

Enable the API

Usage

Install the Serverless Framework.

npm install serverless -g

Install all dependency library:

npm install

Deploy:

sls deploy

For instance, the following curl command sends an image URL to Cloud function.

curl -H "Content-Type: application/json" -X POST \
-d '{"image_url": "https://cloud.google.com/vision/images/rushmore.jpg"}' \
https://some-project-id.cloudfunctions.net/cloudvision