We uses machine learning to detect emotions and depression in audio files. With a focus on simplicity and effectiveness, our project enhances mental health assessments and human-computer interaction. We use advanced techniques to analyze speech signals and provide reliable emotion and depression recognition.
- Supabase Account
- Hugging Face Emotion Detection Model
- OpenAI Chat API Key
- Node and Npm
- Name Domain (Optional)
- Aws EC2 Instance (Optional)
- Create a Supabase account and a new project.
- Set up a database within your Supabase project.
- Use the connection string provided by Supabase to link the database to your project.
- Create a table with the following schema:
-- Create a table for users
CREATE TABLE users (
id SERIAL PRIMARY KEY,
userId UUID NOT NULL,
name VARCHAR(255),
age INT,
gender VARCHAR(10),
emotion VARCHAR(255),
depression NUMERIC(5, 2),
timestamp TIMESTAMP
);
- In your Supabase project, navigate to the project settings.
- Select the "Auth" section.
- In the "Redirect URL" field, set the appropriate redirect URL for your environment:
- For local development, use "http://localhost:3000" or your local host URL.
- For your own domain, use the URL pointing to your hosted application.
- For an EC2 instance, use the public URL of the instance.
Refer to the Hugging Face Model Repository for instructions on setting up the Emotion Detection model and obtaining the required API and Auth Token.
To obtain your OpenAI Chat API Key, please follow the instructions provided by OpenAI on their official website here.
Host the application using one of the following options:
- Purchase a domain name from a domain registrar.
- Set up an ssh EC2 Instance on Aws.
- Configure DNS forwarding on your hosting provider to link your domain with your SSH instance.
- Start the Apache server on your instance with virtual host.
You can follow this YouTube video for detailed instructions.
Once everything is set up, open your domain in a web browser. You should see a page like this.
If all good move on to Frontend Deployment.
-
Create an EC2 instance on AWS with the Ubuntu distribution. You can follow this Article.
-
Install Apache2 and enable necessary modules with these commands:
sudo apt update sudo apt install apache2 sudo a2enmod ssl proxy proxy_http headers rewrite
-
Restart the Apache2 service:
sudo systemctl restart apache2
Once everything is set up, open your domain in a web browser. You should see a apache success page like this.
If all good move on to Frontend Deployment.
No additional setup is needed for local hosting.
-
Duplicate the
.env.example
file provided in the project to create a new file called.env
. -
Fill in the required values in the
.env
file based on the following instructions. You should have obtained these values during the setup steps:NEXT_PUBLIC_FRONTEND_URL
: Replace this with your public site URL. It can be a domain, a server address, or "localhost," depending on your hosting choice.NEXT_PUBLIC_OPEN_CHAT_API_KEY
: Follow OpenAI's instructions to obtain an API key and replace this with your Chat API key.NEXT_PUBLIC_EMOTION_DETECTION_API
: The URL of your Hugging Face emotion detection model API.NEXT_PUBLIC_EMOTION_DETECTION_AUTH_TOKEN
: If your model API requires an authorization token, include it here.NEXT_PUBLIC_SUPABASE_URL
: The URL of your Supabase project.NEXT_PUBLIC_SUPABASE_KEY
: Your Supabase project's anonymous key.
Clone the project repository from the organization.
git clone https://github.com/Psych-2-Go-Ai/front-end-emotion-detection.git
Create a Swap file
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Install the required packages
sudo npm install
sudo npm install -g pm2 react next
Buil and start the application.
sudo npm run build
pm2 start npm --name "emotion detection" -- start --watch
View logs with pm2 logs
.
Contributions are welcome! If you'd like to contribute to this project, follow these steps:
- Fork the project.
- Create a new branch for your changes.
- Make your desired changes.
- Push your changes to your fork.
- Create a pull request to merge your changes.
That's it! Your contributions are appreciated.
This project is licensed under the MIT License - see the LICENSE file for details.