项目作者: mikaelvesavuori

项目描述 :
Machine learning image labeling service on GCP
高级语言: JavaScript
项目地址: git://github.com/mikaelvesavuori/gcp-ml-image-labeling-service.git


ML image labeling service, using Google Cloud Platform

This repo contains the source code for a machine learning-powered image labeling service, running as a serverless backend function.

It was made as part of a backend for the serverless tech demo application ArtCollector but works just fine without any specific ties to that project.

This will be of great usage if you want to quickly set up an image tagging service or you could extend it to be used for checking if any posted images contain graphic/adult content.

Prerequisites

Instructions

Deployment

Just run sls deploy and it should deploy just fine, given that you configured the above steps and have a GCP account.

If you get a weird Gaxios error, make sure that your service name in serverless.yml does not contain dashes. That should fix it.

Using the labeling service

Do a POST request to your URL, which will look something similar to https://europe-west1-cloud-developer-basics.cloudfunctions.net/getLabels.

Send a payload with the body containing an imageUrl key with the value being the URL for an image, so it looks like this:

  1. {
  2. "imageUrl": "https://uploads1.wikiart.org/images/giorgio-de-chirico/mystery-and-melancholy-of-a-street-1914.jpg"
  3. }

Your response should come back similar to the below:

  1. [
  2. "Architecture",
  3. "Illustration",
  4. "Visual arts",
  5. "Building",
  6. "Arch",
  7. "Art",
  8. "Arcade",
  9. "Facade",
  10. "Column",
  11. "Painting"
  12. ]

Tech used in this repo

  • Cloud Functions is an event-driven, serverless function-as-a-service offering that enables us to run backends without any server management
  • Cloud Vision API uses machine learning to infer labels from images