https://github.com/karansingla-dev/emotion-music-player
https://github.com/karansingla-dev/emotion-music-player
deepface docker docker-compose fastapi nextjs pytorch spotify-web-api tailwindcss tensorflow
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/karansingla-dev/emotion-music-player
- Owner: karansingla-dev
- Created: 2025-09-01T17:07:25.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-09-02T17:57:46.000Z (about 1 month ago)
- Last Synced: 2025-09-02T19:31:12.461Z (about 1 month ago)
- Topics: deepface, docker, docker-compose, fastapi, nextjs, pytorch, spotify-web-api, tailwindcss, tensorflow
- Language: TypeScript
- Homepage: https://emotion-music-player-n3fh.vercel.app/
- Size: 91.3 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![]()
# πΆ Emotion-Based Music Player
An **AI-powered music recommendation app** that detects your real-time **facial emotions** π₯ and suggests personalized **Spotify tracks** π΅ based on your **mood, language, and genre preferences**.
Built with **FastAPI + Deep Learning (FER/DeepFace) + Next.js + Tailwind + Spotify API + Docker** π
---
## β¨ Features
- β Real-time **emotion detection** from webcam (happy, sad, angry, surprise, neutral, etc.)
- β **Spotify integration** to fetch recommended tracks π§
- β User can choose **preferred language** (English, Hindi, Punjabi, etc.)
- β User can choose **preferred genre** (Pop, Rock, Classical, Lofi, etc.)
- β Built-in **music player** (Play, Pause, Seek) using Spotify `preview_url`
- β **Fallback to Spotify app** if no preview available
- β Beautiful **UI with Tailwind + Framer Motion animations**
- β **Dockerized backend** for smooth deployment---
## πΌοΈ Demo

---
## ποΈ Tech Stack
### π― Frontend
- [Next.js 14](https://nextjs.org/) + [React](https://react.dev/)
- [Tailwind CSS](https://tailwindcss.com/) for styling
- [Framer Motion](https://www.framer.com/motion/) for animations### β‘ Backend
- [FastAPI](https://fastapi.tiangolo.com/)
- [FER](https://github.com/justinshenk/fer) / [DeepFace](https://github.com/serengil/deepface) for emotion recognition
- [TensorFlow](https://www.tensorflow.org/) & [PyTorch](https://pytorch.org/)
- [Spotify Web API](https://developer.spotify.com/documentation/web-api/)### π³ Deployment
- Docker + Docker Compose---
## π Getting Started
### 1οΈβ£ Clone the Repo
```bash
git clone https://github.com/your-username/emotion-music-player.git
cd emotion-music-player
```---
### 2οΈβ£ Backend Setup (FastAPI + Docker)
```bash
cd backend
cp .env.example .env # add your SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET
docker compose up --build
```Backend will start on:
π [http://localhost:8000/docs](http://localhost:8000/docs)---
### 3οΈβ£ Frontend Setup (Next.js)
```bash
cd frontend
npm install
npm run dev
```Frontend will run on:
π [http://localhost:3000](http://localhost:3000)---
### 4οΈβ£ Spotify API Setup
1. Go to [Spotify Developer Dashboard](https://developer.spotify.com/dashboard/)
2. Create a new app β get `CLIENT_ID` and `CLIENT_SECRET`
3. Add them in `backend/.env`:```env
SPOTIFY_CLIENT_ID=your_id_here
SPOTIFY_CLIENT_SECRET=your_secret_here
```---
## π₯ How It Works
1. User opens the app β grants camera permission
2. Camera captures frames every few seconds
3. Backend analyzes face β detects emotion
4. Based on emotion + selected **language/genre**, Spotify API is queried
5. App displays recommended songs with a built-in music player---
## π Project Structure
```
emotion-music-player/
βββ backend/ # FastAPI + Emotion Detection
β βββ app/
β β βββ main.py # FastAPI routes
β β βββ emotion.py # Emotion detection logic
β βββ Dockerfile
β βββ requirements.txt
β
βββ frontend/ # Next.js + Tailwind
β βββ src/app/
β β βββ player/page.tsx # Main player UI
β β βββ components/ # AudioPlayer, CameraCapture etc.
β βββ package.json
β βββ tailwind.config.js
β
|ββ docker-compose.yml
βββ assets/ # Screenshots, banner, GIFs
β βββ banner.png
β
βββ README.md
```---
## π οΈ Future Improvements
- π€ Voice commands (e.g., βplay happy songsβ)
- π± Mobile app version with React Native / Flutter
- π€ Multi-user support with accounts
- π¨ More advanced UI like Spotify clone---
## π¨βπ» Contributors
- **Your Name** β [@karansingla007](https://github.com/karansingla007)
---
## β Support
If you like this project, donβt forget to **star β the repo**.
Pull requests are welcome π---