All Projects → ramhiser → serverless-cloud-vision

ramhiser / serverless-cloud-vision

Licence: MIT license
Serverless API around Google Cloud Vision

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to serverless-cloud-vision

serverless-api-gateway-throttling
A plugin for the Serverless framework which configures throttling for API Gateway endpoints.
Stars: ✭ 54 (+74.19%)
Mutual labels:  api-gateway, serverless-framework
tencent-apigateway
Easily provision Tencent API Gateway using Serverless Components
Stars: ✭ 33 (+6.45%)
Mutual labels:  api-gateway, serverless-framework
Serverless Api Gateway Caching
A plugin for the Serverless framework which helps with configuring caching for API Gateway endpoints.
Stars: ✭ 92 (+196.77%)
Mutual labels:  api-gateway, serverless-framework
Serverless Express
Run Node.js web applications and APIs using existing application frameworks on AWS #serverless technologies such as Lambda, API Gateway, Lambda@Edge, and ALB.
Stars: ✭ 4,265 (+13658.06%)
Mutual labels:  api-gateway, serverless-framework
sls-photos-upload-service
Example web app and serverless API for uploading photos and saving to S3 and DynamoDB
Stars: ✭ 50 (+61.29%)
Mutual labels:  api-gateway, serverless-framework
Serverless Stack Demo Api
Source for the demo app API in Serverless-Stack.com
Stars: ✭ 486 (+1467.74%)
Mutual labels:  api-gateway, serverless-framework
Serverless Next.js
⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+9503.23%)
Mutual labels:  api-gateway, serverless-framework
aws-swaggerui
Serverless Swagger UI for API Gateway
Stars: ✭ 26 (-16.13%)
Mutual labels:  api-gateway, serverless-framework
CloudFrontier
Monitor the internet attack surface of various public cloud environments. Currently supports AWS, GCP, Azure, DigitalOcean and Oracle Cloud.
Stars: ✭ 102 (+229.03%)
Mutual labels:  api-gateway, serverless-framework
Serverless Aws Alias
Alias support for Serverless 1.x
Stars: ✭ 171 (+451.61%)
Mutual labels:  api-gateway, serverless-framework
Zappa
Serverless Python
Stars: ✭ 224 (+622.58%)
Mutual labels:  api-gateway, serverless-framework
noiiice
a serverless blog built on NuxtJS, AWS, serverless framework, and irrational exuberance.
Stars: ✭ 42 (+35.48%)
Mutual labels:  api-gateway, serverless-framework
hyperform
⚡ Lightweight serverless framework for NodeJS
Stars: ✭ 156 (+403.23%)
Mutual labels:  api-gateway, serverless-framework
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (+64.52%)
Mutual labels:  api-gateway, serverless-framework
nestjs-graphql-serverless
Boilerplate for using NestJS with GraphQL (Code-First) on serverless environment (AWS Lambda)
Stars: ✭ 64 (+106.45%)
Mutual labels:  api-gateway, serverless-framework
Serverless Architectures Aws
The code repository for the Serverless Architectures on AWS book
Stars: ✭ 120 (+287.1%)
Mutual labels:  api-gateway, serverless-framework
pong
🏓 Pong for RESTful APIs (microservices pattern) using Serverless Framework ⚡
Stars: ✭ 27 (-12.9%)
Mutual labels:  api-gateway, serverless-framework
amazon-ivs-chime-web-demo
A demo web application intended as an educational tool for demonstrating how to load and play Amazon IVS streams alongside the Amazon Chime SDK.
Stars: ✭ 35 (+12.9%)
Mutual labels:  api-gateway, serverless-framework
Zappa
Serverless Python
Stars: ✭ 11,859 (+38154.84%)
Mutual labels:  api-gateway, serverless-framework
amazon-ivs-ugc-web-demo
This repository shows how you can build a compelling user-generated content (UGC) live streaming webapp with Amazon IVS.
Stars: ✭ 14 (-54.84%)
Mutual labels:  api-gateway, serverless-framework

Serverless API around Google Cloud Vision

This project is a serverless API wrapper around Google Cloud Vision using AWS API Gateway + AWS Lambda. Deployment is performed with the Serverless Framework.

Details are described in this blog post.

Usage

The API Gateway endpoint accepts an image URL and triggers a Lambda function, which ingests the image from a URL and sends the image to Google Cloud Vision for standard image recognition tasks (e.g., facial detection, OCR, etc.).

For instance, the following curl command sends an image URL to the API Gateway.

curl -H "Content-Type: application/json" -X POST \
-d '{"image_url": "https://raw.githubusercontent.com/ramhiser/serverless-cloud-vision/master/examples/images/ramhiser-and-son.jpg"}' \
https://some-api-gateway.execute-api.us-east-1.amazonaws.com/dev/detect_image

The response JSON includes a variety of metadata to describe the faces detected:

{
  "responses": [
    {
      "faceAnnotations": [
        {
          "angerLikelihood": "VERY_UNLIKELY",
          "blurredLikelihood": "VERY_UNLIKELY",
          "boundingPoly": {
            "vertices": [
              {
                "x": 512,
                "y": 249
              },
              {
                "x": 637,
                "y": 249
              },
              {
                "x": 637,
                "y": 395
              },
              {
                "x": 512,
                "y": 395
              }
            ]
          },
          "detectionConfidence": 0.98645973,
          ...

In the examples folder, we provide a script that produces a new image with bounding boxes around the faces detected:

highlighted faces

Beyond facial detection, Google Cloud Vision supports the following image recognition tasks:

  • LABEL_DETECTION
  • TEXT_DETECTION
  • SAFE_SEARCH_DETECTION
  • FACE_DETECTION
  • LANDMARK_DETECTION
  • LOGO_DETECTION
  • IMAGE_PROPERTIES

Google Cloud Vision Credentials

In order to access the Cloud Vision API, you will need to create Google Application Credentials by following the instructions here for the Service Account Key. Then, download the JSON file with your application credentials and rename the file as cloudvision/google-application-credentials.json.

Deployment

Make sure you have Node.js 4.0+ installed. Then, install the Serverless Framework.

npm install serverless -g

Install any Python dependencies to the cloudvision/vendored folder.

pip install -t cloudvision/vendored/ -r requirements.txt

NOTE: Homebrew + Mac OS users who encounter the DistutilsOptionError error should see this SO post for a fix.

After installing Python requirements to the vendored folder, type the following at the commandline to deploy the wrapper API:

serverless deploy

This command does the following:

  • Create IAM roles on AWS for Lambda and API Gateway
  • Zips Python code and uploads to S3
  • Creates AWS Lambda function
  • Creates API Gateway endpoint that triggers AWS Lambda function

Examples

Example Python scripts are available in the examples folder. These examples require that the API (described above) be successfully deployed. As mentioned by Chris Cooper, the Python dependencies must be installed locally in order to run the examples. To do this, type the following locally:

pip install -r requirements.txt
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].