Define Emotion AI is a web app that leverages AI to analyze user's text and identify emotional states. The platform offers advice and provides emergency contact information to support mental health. Its goal is to enhance emotional well-being by helping users understand and monitor their emotions.
The project was developed for the "Accelerate App Development with GitHub Copilot" hackathon, showcasing how AI can streamline and optimize coding.
- Emotion Analysis: Uses the Hugging Face DistilBERT-based emotion model to detect emotions like joy, sadness, anger, love, fear, and surprise.
- Personalized Advice: Offers tailored advice based on the detected emotion.
- Emergency Help: Provides mental health helplines and resources based on the user’s country and city.
- User Authentication: Users can save and manage their emotion records securely.
- Data Visualization: Displays a chart of users' emotional states over time.
- Backend: Spring Boot v3.4.1 (Java v21.0.1)
- Frontend: Thymeleaf, HTML, CSS, JavaScript
- Database: H2 Database
- AI Model: Hugging Face API
- Build Tool: Maven v3.9.9
- Security: Spring Security
- IDE: VS Code
- Clone the repository:
git clone https://github.com/vero-git-hub/define-emotion.git
cd define-emotion
- Install dependencies:
mvn clean install
- Set up environment variables in application-local.properties:
huggingface.emotion.api.url=your_huggingface_api_token
huggingface.emotion.api.token=your_huggingface_api_token
Replace your_huggingface_api_url
and your_huggingface_api_token
with your actual Hugging Face API details.
-
Fill out your emergency helplines in
country-cities.json
. To protect confidential data, the demo file uses fake data. Replace it with real data for production use. -
Run the application:
mvn spring-boot:run
- Open your browser and navigate to http://localhost:8080.
-
Registration & Login:
- Enter username, email, and password.
- Sign up with your credentials.
-
Fill out your profile:
- Click the Profile button, then Edit Profile.
- Choose your country and city from the dropdown list.
- Click Save Changes.
-
Analyze Emotion:
- Click Add Emotion.
- Enter text in the input field and click "Analyze."
- The detected emotion and corresponding advice will be displayed.
-
Save Emotion:
- After analysis, click Save to store the result in your personal emotion log.
-
View Emotion History & Chart:
- Navigate to the Emotion List page to see all saved emotions.
- Click the Chart button to view your circle emotion chart.
-
Emergency Help:
- Click the Emergency button to view mental health helplines based on your location.
- After clicking Help, a list of available helplines will appear. You can call, visit the website, or send an SMS by hovering over the respective button to view the details.
Contributions are welcome! Please follow these steps:
-
Fork the repository.
-
Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Added new feature"
- Push your branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.