In Developers, Built With Clarifai

Clarifai Featured Hack: Get Addicted to Snap Tag, an App to Test Your Photo Taking Skills

By Team Clarifai

Our team has been busy traveling across North America and Europe, (willingly) foregoing sleep, showers, and sanity to take part in some of the best university hackathons around. These are chances for us to connect with new and existing users, recruit for our open positions, and watch teams build really amazing things with our API. Our new Clarifai Featured Hack series will share the coolest of the cool, so hold onto your butts.


**Update: As of Nov. 15, 2017, we have transitioned our API to V2. Please read our V1 to V2 transition guide before implementing the code in this blog.  


Remember when you were a kid and you’d play tag on the playground? And some big kid would always catch you, say “Tag, you’re it!”, and rub your face in the dirt? No? Ok, maybe it’s just me. Anyway, Snap Tag is kind of like an endless game of tag, only with photos (and without the dirt).
Snap Tag is an app that allows users to send pictures to each other – with a catch. When you send a picture to your friend, it is automatically tagged with three words that are relevant to the content in the photo. When your friend receives the photo, they have to respond with a picture that matches at least one of the three tags you sent, thus returning the challenge with their own photo and set of tags.

WHY WE ❤ IT
We get to play Snap Tag at the office and call it work, so that’s pretty neat. It’s kind of like a photo scavenger hunt but really fun and social. Sometimes it’s easy and straightforward (take a picture of a tree!), but sometimes it’s a bit harder to find right away (Mexican Restaurant!). And, sometimes it’s borderline trolling your boring life (hot air balloon?! Ugh, I wish).


HOW YOU DO IT
We asked Joey Li of the Snap Tag team to tell us the deep, dark, sinister secrets to creating the most addicting game we’ve played in a while. Here’s what he had to say!


Clarifai: What inspired your idea for a photo “tag” game?
Joey: At DubHacks 2015, my team (Kevin Wong, Lisa Li, and Luxi Xu from the University of British Columbia and Malcolm Daigle from the University of Washington) wanted to make an app that would be cool enough to use ourselves. We challenged ourselves to make use of the seemingly magical Clarifai API for generating tags for images.


C: How does the game work?
J: Our game is simple: send a picture to a friend and the app will automatically generate three tags for it. The receiver is only allowed to respond with a picture that has at least one of those three tags, but not all three. Here’s the catch: the receiver can’t see the tags, and the number of attempts is passed along with the picture. One can liken it to a game of telephone with pictures. Or a game of tag … Snap Tag – that’s pretty catchy. You can find it on GitHub. Not everything works yet, and it likes to randomly crash sometimes, but we’re excited to continue improving it!


C: What’s the magic sauce behind your Clarifai implementation?
J: The key here is parsing the JSON response from the /v1/tag endpoint. By default, the API returns the top 20 tags for each image. In Snap Tag’s case, 20 tags would be too easy! So, to restrict the valid photo responses to only the top three tags, you can select top-n from results[0].result.tag.classes. The tags are sorted by decreasing probability, so “top-3” will give you the 3 most applicable tags.


Thanks for sharing, Joey!


To learn more, check out our documentation and sign-up for a free Clarifai account to start using our API – all it takes is three lines of code to get up and running! We’re super excited to share all the cool things built by our developer community, so don’t forget to tweet @Clarifai to show us your apps.
And give Joey, Kevin, Lisa, Luxi, and Malcolm some props in the comments below. Until next time!

Previous Next