This repository contains two main components:
- Model Training: Scripts for training the fusion model (Audio CNN + FNN).
- Web Application: A Next.js frontend and Flask backend to interact with the trained model.
We use python 3.10: brew install python@3.10
You need two separate Python virtual environments:
- Training Environment: For training models.
- Backend Environment: For running the Flask backend. (make sure you are in the backend directory when creating)
Create the environments as follows:
python3.10 -m venv training_env
source training_env/bin/activate # On Windows: training_env\Scripts\activate
pip install -r requirements.txt
deactivate
cd app/backend
python3.10 -m venv backend_env
source backend_env/bin/activate # On Windows: backend_env\Scripts\activate
pip install -r requirements.txt
deactivate
cd app/frontend
npm install
Feature Extraction: Extract audio features from the RAVDESS emotion audio dataset (takes a ~10-15 minutes to complete)
source training_env/bin/activate # Activate the training environment
python cnn/ravdess_feat_extraction.py
python fnn/01-cremad_feat_extraction.py
python fnn/02-cremad_FNN.py
deactivate
cd app/backend
source backend_env/bin/activate # Activate the backend environment
flask run --port=5000 # Start the Flask backend server
cd ../frontend
npm run dev # Start the Next.js frontend server
Open your browser and go to:
http://localhost:3000/
- You will be automatically redirected to
http://localhost:3000/AudioRecorder
within 20 seconds. - Press the "Record" button and talk about your day for 20 seconds.
- After recording, you will be redirected to the MBTI Prediction Page in approximately 30 seconds.
.
├── app/
│ ├── frontend/ # Next.js frontend
│ ├── backend/ # Flask backend
│ └── requirements.txt # Python dependencies for backend
├── cnn/ # CNN-related scripts
│ └── ravdess_CNN.py
│ └── ravdess_feat_extraction.py
├── fnn/ # FNN-related scripts
│ ├── 01-cremad_feat_extraction.py
│ └── 02-cremad_FNN.py
└── requirements.txt # Python dependencies for training
The cnn/ravdess_CNN.py file is the architecture of the CNN and is trained using extracted audio features from the RAVDESS dataset
- Ensure you activate the correct virtual environment before running scripts or servers.
- The training environment is for running CNN and FNN scripts.
- The backend environment is for running the Flask backend.
- Both the Flask backend and Next.js frontend must run simultaneously for the application to work.