I've been really interested in Neural Networks and I wanted to step up my game by learning deep learning (no pun intended). I built an Recurrent Neural Network that learns and predicts words based on its training. I chose Trump because I expected to get a funny outcome, but it seems that my AI is obsessed with "controlling this country" (seriously)... so I turned out to be a little more political than expected. I wanted a challenge, to make something fun. I used 2 programming languages, did the app UI, implemented speech-text, NLP, did the backend, trained 2 models of ~10h each, learned a lot and had a lot of fun.

What it does

Using Nuance API, I am able to get user input as voice and in real time the iOS app gives feedback to the user. The user then submits its text (which he can edit in case Nuance didn't recognize everything properly) and I send it to my server (which is physically located in my home, at this right moment :D). In my server, I built a RESTfull API in Python using Flask. There, I get the request sent from iOS, take the whole sentences given by Nuance, then I use the Lexalytics API (Semantria) to get the sense of the sentence, to finally feed my Trump AI model which is going to generate a sentence automatically.

How I built it

First I built the RNN which works with characters instead of words. Instead of finding probabilities of words, I do with characters. I used the Keras library. After, I trained two models with two different parameters and I chose the best one (Unfortunately, the best one means that it has a 0.97 LOSS -remember the closer to 0, the better it is). The RNN didn't have enough time and resources to learn punctuation properly and grammar sometimes is... Trumpish. Later I built the API in Python using flask, where I implemented Semantria. I exposed an endpoint to receive a string so magic could happen. With Semantria I get the sense of the string (which is submitted by the user as VOICE), and I Trumpify it. The IOS app is built on Swift and I use two pods: Nuance SpeechKit and Alamofire (to make my requests cleaner). The UI is beautiful (trust me, the best) and I interact with the user with text, sound and change of colours.

Challenges I ran into

Building the RNN was really difficult. I didn't know where to start but fortunately it went good. I am happy with the results, and I am definitely going to spend more time improving it. Also, the Simantria API has not so good documentation. I had to figure out how everything worked by tracking sample codes and THAT made it a challenge. I can't recall of something that was still valid in the current code while reading the current documentation. I still thank all the Lexalytics peoplele assistance over Slack.. you guys are great.

Accomplishments that I'm proud of

Pretty much everything. Learning deep learning and building a Recurrent Neural Network is... something to be proud of. I learned python over the past week, and today I built two major things with it (an API and a RNN). I am proud of my Swift skills but I consider myself an iOS developer so it is nothing new. Mmmm... I'm also proud of the way I implemented all those services, which are complex (RNN, NLP, Voice-To-Speech, the API, etc), alone. I solo'd this hackathon and I am also proud of that. I think that today I achieved a new level of knowledge and it feels great. My main goal was to step up my game, and it indeed happened.

What I learned

Flask, Python, Nuance API, Simantria API... I even learned some Photoshop while working on the UI. I learned how to build an API (I had no idea before)... I learned about RNNs... Wow. A lot.

What's next for Trumpify

Since I already have a server at home, I can host Trumpify backend without much cost. I'd say that the next step for Trumpify would be improving the Recurrent Neural Network so Trumpify gets smarter and says less non sense. I'll also publish this app in the App Store, so people can interact with trump, but in a funny way. If someone is interested I could also feature this app somewhere... who knows. I may even use this technology to create things in a more serious approach, instead of Trump.

Built With

Share this project: