This project is a serverless API wrapper around Google Cloud Vision using Google Cloud Function. Deployment is performed with the Serverless Framework.
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.
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