Emotions Diary

Project:

Intro: First and foremost, 3 of us are high school students, and this was the first hackathon for the majority of us. We came in extremely inexperienced and could not accomplish much of this without the guidance of our mentors. After brainstorming, and hearing about the GCP prize of course, we wanted to somehow implement mental health with artificial intelligence, a website, lots of cats, and the offered $50 of free GCP credit to create a smart diary that could uplift others based on the sentiment value derived from a Natural Language Processing analysis of their diary entry.

Front-End: We wanted the landing page to feel welcoming since we want all of our users to feel comfortable using our site. The user is invited to enter a heartfelt journal entry. Once they typed in an entry and pressed submit, their journal entry is sent as a string to the Google Cloud Natural Language Processing pre-trained Sentiment Analysis model to be analyzed and return a sentiment score. In the end, we end up with an appropriate message popping up based on the calculated sentiment score of the entry. If the sentimental value is too low, we actually show the National Suicide Prevention Lifeline number just in case a life needs to be saved. Of course, to maximize comfort, we amped up the cuteness meter by adding lots and lots of cat photos to our website!

Back-end: Since we utilized Google Cloud’s pre-trained Natural Language Processing Sentiment Analysis Model, we actually did not code the backend ourselves. We would have required thousands of labeled sample texts to train our model, and we didn’t have the resources or the time to create such a hefty database ourselves. Instead, we had to integrate Google’s pre-trained model into our HTML page front-end. We used Flask and Python to do so. We took the inputted data from the text field as a string saved to a variable. Google’s machine learning model was then called to analyze that string variable and return a sentiment score ranging from -1 to 1, with -1 being the most negative and 1 being the most positive. Based on this sentiment score, an appropriate response was returned to the user to either uplift them, comfort them, or encourage them.

Significant Challenges/Areas of Growth:

Linking the front and back end: This was by far the biggest challenge of the project. We originally attempted to do this all in JavaScript before realizing that Google did not provide a way to integrate its machine learning model on the client-side. We then had to scrap all of our code and start over, using Python and learning how to use Flask to deploy our Python code in a web app. Even then, we struggled a lot with small errors that would come up during the interchange between the front and back end. Once we got it to work, we realized that GitHub's requirements for hosting a site and Flask's requirements for using a Python web app conflicted, and we were only able to deploy our program locally.

Collaboration: Collaboration was difficult since only half of us have ever used GitHub. In the end, we learned how to commit, push, pull, and properly collaborate on code. We also had to learn teamwork and communication skills, as well as a lot of patience.

Natural Language Processing Model: Though everyone always talks about how easy Google Cloud Platform is, we actually admittedly struggled a lot. We couldn’t figure out what type of data to import, how to format the data, how to train the model, and so forth. We many failed attempts at data import even though it's probably the easiest part. In the end, we used two models. One we actually trained ourselves using a downloaded dataset. Through this process, the biggest thing we learned was the concept of precision and recall and how the model balances both to create a model that best fits the situation at hand, in this case, sensing emotion. Unfortunately, we didn’t actually get to use this model because it turned out it was only trained to detect subtle differences in positive emotions rather than emotion as a whole. Training a model the way that we wanted it would have required a database of thousands of diary entries labeled with specific emotions such as anger, frustration, despair, etc. We had neither the time nor the resources to create such a database. Due to the time crunch, we used a pre-trained model from Google Cloud Platform that parses and analyzes the entry and returns a sentiment value. We then hard-coded responses on the front-end based off the sentiment value.

Future Improvements This project could be much improved in the future with a custom-trained dataset able to identify specific emotions rather than just a range from negative to positive. Our responses would be able to be more appropriate then. A custom trained dataset would also improve the sentiment identification, because the pre-trained model was trained on and for analysis of customer feedback, not personal diary entries. With more time, we would have been able to host our project on a site rather than requiring it to be run locally due to requirement conflicts in Flask and GitHub site hosting. We could also make our front-end webpage nicer using modern UI/UX theory. In the future, we see this as a potential mental health assistance app and a way for people to vent and receive some form of response when they cannot reach a real person.

Share this project:

Updates