Created
February 27, 2016 11:33
-
-
Save abeisgoat/efe683b46afd2d1bfdaf to your computer and use it in GitHub Desktop.
Google Vision Shell Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#################################################### | |
## Google Vision API Client ## | |
#################################################### | |
# | |
# 1. Create "key" file with GCloud credential | |
# 2. run ./annotate.sh URL | |
# 3. Get back Vision API tags | |
# | |
#################################################### | |
echo "Prepping..." | |
REQUEST='{"requests":[{"image":{"content":"BASE64"},"features":[{"type":"LABEL_DETECTION","maxResults":5}]}]}' | |
BASE64_IMAGE=$(curl $1 | base64 -) | |
KEY=$(cat key) | |
echo "Alright, calling da googs..." | |
echo ${REQUEST/BASE64/$BASE64_IMAGE} | curl -k -s -H "Content-Type: application/json" https://vision.googleapis.com/v1/images:annotate?key=$KEY --data-binary @- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment