Machine learning image labeling service on GCP
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.
serverless.yml
with your project ID and a path to your keyfile/credentialsJust 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.
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:
{
"imageUrl": "https://uploads1.wikiart.org/images/giorgio-de-chirico/mystery-and-melancholy-of-a-street-1914.jpg"
}
Your response should come back similar to the below:
[
"Architecture",
"Illustration",
"Visual arts",
"Building",
"Arch",
"Art",
"Arcade",
"Facade",
"Column",
"Painting"
]