Senti AI

Posted by Omar Irfan Khan on May 01, 2020 · 5 mins read

Senti AI is an android application that functions as your day to day personal diary. The android application is the client that sends the diary content posted by the user to the Amazon EC2 cloud which hosts flask file and machine learning models. The flask file takes the input request sends it to the machine learning models for prediction and it sends the response as happy or sad back to the client. The app was created to boost mental health of the users. It gives them a good perspective of their mental emotion everyday. This way users can understand them and be able to adjust their lifestyle. Example: Form good habits, Practice self-care, etc.

Collaborated with selvans who is another talented developer who you can check out here.

Libraries

Some of the tools required to make this project work:
  • Pandas - input data analysis and manipulation tool.
  • NumPy - further data manipulation and conversion.
  • Tensorflow - contains tools to create different neural networks and metrics.
  • SpaCy - removing stopwords, punctuation and more from the input data.
  • Matplotlib - creating static graphs.
  • GloVe - contains word embeddings which is used in the embedding layer.
  • Nginx - load balancer to handle the amount of GET and POST requests.
  • Gunicorn - worker application that runs in the background so the flask file can always listen for requests.

Method

  • Preprocessing: The IMBD movie dataset was utilized for training the model. It contains 50K movie reviews, where 25k are positive reviews and 25k are negative reviews. Preprocessing was required to remove alot of the stopwords, punctuation, html tags and lemmatization was carried out.
  • Model: An LSTM was chosen as our ideal model which was utilized along with an embedding layer from GloVe. Several parameters like earlystopping, model checkpoint and accuracy were used.
  • Application development: The application was developed using android studio and was made with adherence to the Google Material Design Guidelines.
  • Model deployment: The model along with the flask file were deployed on AWS EC2. The mobile application acts as a client while the flask file provides RESTFUL API services in the cloud. All the data is stored locally using SQLite.

Flowchart & Walkthrough

You can hover over the flowchart to zoom in.
awsflowchart
walkthroughh

Compatibility

The android application currently supports Oreo (Android 8.0+) and Pie (Android 9.0+) versions.

Updates

  • The model needs to be fine-tuned for improved precision towards analyzing the sentiment of the text.
  • Graph and Charts for visualizing sentiment trends have to be developed.
  • Backward compatibility of the application can be improved.
  • WorkManager class needs to be added to provide support for reminder.
  • Settings preference needs to be provided to the user, so that the user can decide what features to turn on and off.

More info on Github.