Skip to content

Instantly share code, notes, and snippets.

@assembler
Created June 22, 2013 09:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save assembler/5840222 to your computer and use it in GitHub Desktop.
Save assembler/5840222 to your computer and use it in GitHub Desktop.
require 'face'
client = Face.get_client(api_key: 'XXX', api_secret: 'XXX')
# training skybiometry to recognize Johnny Depp
resp = client.faces_detect(urls: %w[http://topmostcelebrities.blogsome.com/wp-admin/images/Johnny%20Depp-0.jpg])
client.tags_save(uid: 'johnnydepp@celebs', tids: resp['photos'][0]['tags'][0]['tid'])
client.faces_train uids: 'johnnydepp@celebs'
# trying to recognize it from other pic
client.faces_recognize(uids: 'all@celebs', urls: %w[http://images5.fanpop.com/image/photos/31400000/Johnny-johnny-depp-31410766-861-1023.jpg])
# recognized with 40% confidence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment