Skip to content

software-students-spring2025/5-final-five-timers-club

 
 

Repository files navigation

Lint-free Machine Learning Client CI Web App CI

Emotify: Emotion Detection and Music Recommendation

Description

This project is an application that detects a user's emotions from their facial expressions and recommends music based on their expression. The system processes webcam images to identify emotions and uses Spotify's API to play songs that match the detected emotion.

Team Members

Oluwapelumi Adesiyan
Polina Belova
Gabriella Codrington
Maya Mabry

Overview of System Architecture

This system consists of three interconnected components:

  • Machine Learning Client - Captures webcam images, detects facial emotions using DeepFace, and requests matching songs from Spotify's API.
  • Web Application - A Flask-based frontend that lets users capture images, trigger emotion detection, and view their emotion history with recommended songs.
  • MongoDB Database - Stores emotion detection history and song recommendations for user tracking and review.

Prerequisites

Ensure the following tools are installed:

  • Python 3.11+
  • MongoDB
  • Spotify Developer Account (for API access)
  • Docker and Docker Compose

🗂️ Project Structure

.
├── web-app/ # Flask frontend
│ ├── app.py # Main web app logic
│ ├── auth.py # User authentication
│ ├── requirements.txt
│ ├── templates/ # HTML templates
│ ├── Dockerfile
│ └── static/ # CSS and JavaScript
├── machine-learning/ # Emotion detection service
│ ├── face_recog.py # Facial emotion detection
│ ├── get_playlist.py # Spotify API integration
│ └── requirements.txt
│ ├── Dockerfile
└── README.md # You are here
└── docker-compose.yml

🔐 Environment Configuration

Create a .env file in your project root folder with the following variables:

CLIENT_ID=your_client_ID
CLIENT_SECRET=your_client_secret
MONGO_URI=mongodb+srv://username:password@cluster.example.mongodb.net/?retryWrites=true&w=majority
SECRET_KEY=your_secret_key

Visit Emotify

Visit Emotify, deployed using DigitalOcean, at http://165.22.180.89:5001/.

Development Setup

Local Development with Docker

  1. Clone the repository:

    git clone https://github.com/software-students-spring2025/5-final-five-timers-club.git
    cd 5-final-five-timers-club
    
  2. Create environment variables file:

    cp .env.example .env
    
  3. Edit the .env file with your development configuration.

  4. Build and start the containers using Docker Compose:

    docker-compose up -d --build
    
  5. The application will be running at http://127.0.0.1:5001

  6. To stop the containers:

    docker-compose down
    

Running Unit Tests

Make sure to install pytest

pip install pytest
cd web-app
pytest tests
cd machine-learning
pytest tests

Features

  • User Authentication - Register and login to track your history
  • Facial Emotion Detection - Detects emotions from webcam images (happy, sad, angry, fearful, surprised, disgusted, neutral)
  • Music Recommendations - Suggests songs from Spotify based on your detected emotion
  • History - Review your past detected emotions and recommended songs

Technologies Used

  • Flask - Python web framework
  • DeepFace - Deep learning facial recognition and emotion detection
  • Spotify Web API - Music recommendation engine
  • MongoDB - Database for emotion and song history
  • Flask-Login - User authentication system
  • OpenCV - Image processing

About

software-engineering-spring-2025-5-final-final-project created by GitHub Classroom

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 59.8%
  • HTML 15.2%
  • JavaScript 11.9%
  • CSS 9.3%
  • Shell 2.7%
  • Dockerfile 1.1%