Add a Little AI to Your Love Letters This Valentine’s Day
Time to read: 2 minutes
Happy Valentine’s Day everyone! There is a lot of love floating around today and you might be looking for a way to tell that special someone exactly what you think of them through the power of prose.
If Shakespeare isn’t your thing, Michael Jordan (of Gifted) is back with another artificially intelligent hack that will help you say all the right things today.
You can give it a try right now by texting a picture to (267) 422-7066.
Love Letters from Her
After a successful holiday season, Michael was asked by many people if there would be a Valentine’s Day rendition of Gifted. He immediately began to brainstorm ways in which he could update the artificial intelligence text messaging service to write love letters.
Michael turned to Hollywood for inspiration and rediscovered the critically acclaimed 2013 film, Her. At the beginning of the movie, Joaquin Phoenix’s character is working as a letter writer. Michael described it as “some parody of a startup you’d see on SNL.” But the scene also gave him a thought, “I wonder if you can automate that?”
What Shall Thee Write?
Michael admits he tried the Shakespearean sonnet route. But it was not personal enough and most of the results seemed like nonsense. Building on past projects, he decided to use photo tags from user generated content tag count for which he already had data. For example, “boy” being mentioned 900,000 times.
With the help of an nltk tokenizer (splitting text into relevant parts of speech) and tf-idf (term frequency-inverse document frequency), Michael was able to analyze the top 150 computer vision tags and tried mad lib style passages.
Still, mad libs were not exactly what he was aiming for. Michael ultimately wrote a thoughtfully crafted sentence for each of the 150 tags. A mechanical engineer by trade, Michael laughed as he expressed how much fun he had showing an amorous side and surprise that he knocked it out in just 15 minutes.
Using the Python Pillow library and Clarifai, when you send an mms to Gifted’s V-day phone number, Gifted will return a personalized poem on top of the image with content based upon their surroundings in the given photograph.
The app architecture hasn’t changed from Michael’s last project however, he couldn’t help but reiterate that using AWS Lambda Twilio makes connecting everything in the app easier. Rather than having to deal with the passing back and forth of media, S3 returns rich media right there!
Below is some of the code that helped Michael bring these love letters to life.
Text a Picture of Your Valentine to (267) 422-7066
I decided to give Her’s letter writing a spin with our CEO, Jeff Lawson.
Here’s how it turned out:
That’s pretty accurate! Except here is the only time Jeff and I have ever been outdoors together:
To learn more about Gifted or try it out for yourself, visit http://www.givingiq.com
If you’re up for building your own artificial intelligence products, check out the following resources:
Tell me what you think of AI or what you plan on building next:
- @meganspeir
- mspeir@twilio.com
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.