This project captures microphone audio recordings, performs emotion classification, stores the results in MongoDB, and displays them on a real-time updating dashboard!
The system runs as 3 coordinated containers controlled by Docker Compose:
┌─────────────────────────────┐ ┌──────────────────────────────┐
│ Flask Web App │ │ ML Client │
│ - Audio recording UI │ │ - Watches for new audio │
│ - Uploads .webm │─────▶│ - Extracts features │
│ - Dashboard of results │◀─────│ - Predicts emotion │
└─────────────┬───────────────┘ │ - Writes to MongoDB │
│ └─────────────┬────────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────┐
│ MongoDB │
│ - Stores filename, mean_f0, mean_rms, emotion │
│ - Queried by web app for live dashboard │
└─────────────────────────────────────────────────┘
| Name | GitHub |
|---|---|
| (kaiyuan wu) | https://github.com/qiexian-mf |
| (Harrison Coon) | https://github.com/hoc2006-code |
| (Jaylon McDuffie) | https://github.com/jm9908 |
| (Sam Murshed) | https://github.com/SamMurshed |
Make sure you have:
- Docker
- Docker Compose
- Python 3.10+ (for linting/tests only)
docker compose up --buildThis will launch:
emotion_web— Flask serveremotion_ml— Machine Learning containeremotion_mongodb— MongoDB
When running successfully:
- Web app → http://localhost:5050
- MongoDB exposed on → 27017
Visit: http://localhost:5050
From here, you can:
- Click Start Recording
- Record 3 seconds of audio
- View live emotion classification results
- See the latest emotion + emoji
- Watch the table auto-refresh every 5 seconds
export PYTHONPATH=$PWD
export TESTING=1
pytest -vA helper script is included:
./run_tests.shThis script:
- Stops old containers
- Rebuilds everything
- Runs CI tests inside the web-app container
- Prints results
Two GitHub Actions workflows run automatically:
- Lints ML client code using black & pylint
- Runs
pytestfor ML unit tests - Reported with a badge in the README
- Lints Flask server
- Runs Flask unit tests
- Ensures formatting & PEP8 compliance
CI triggers on pull request merge to main.
MongoDB runs via Docker using:
mongodb:
image: mongo:6.0
ports:
- "27017:27017"
volumes:
- mongo_data:/data/dbNo extra configuration is needed.
Both services use environment variables from docker-compose:
MONGO_URI=mongodb://mongodb:27017/emotiondb
UPLOAD_DIR=/data/uploads
MONGO_URI=mongodb://mongodb:27017/emotiondb
AUDIO_DIR=/data/uploads
A template for secrets should include:
.env.example