Skip to content

Instantly share code, notes, and snippets.

@agonzalezro
Last active April 23, 2016 21:00
Show Gist options
  • Select an option

  • Save agonzalezro/1d628a7de6268be3c0e0 to your computer and use it in GitHub Desktop.

Select an option

Save agonzalezro/1d628a7de6268be3c0e0 to your computer and use it in GitHub Desktop.
#!/bin/zsh -f
export GOOGLE_APPLICATION_CREDENTIALS=~/Desktop/Vision-74543b759180.json
imagesnap -w 1 /tmp/pic.jpg
result=`pigeon /tmp/pic.jpg`
cat $result
type=`echo $result|jq ".[0].labelAnnotations[0].description"`
type=`echo $type|sed "s/ /%20/g"`
echo "Finding a GIF for: $type"
gif=`curl -q "http://api.giphy.com/v1/gifs/search?q=$type&api_key=dc6zaTOxFJmzC"|jq ".data[0].embed_url"`
/usr/bin/open `echo $gif|tr "\"" " "`
#rm /tmp/pic.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment