Emotion Detector is a full-stack AI web application that analyzes facial expressions in images to detect human emotions.
It combines a React frontend, FastAPI backend, and a deep learning emotion recognition model to deliver a smooth and intuitive user experience.
- User authentication (Sign up / Login / Logout)
- Upload images for emotion analysis
- AI-based facial emotion recognition
- Emotion confidence score
- Emotion history per user
- Secure JWT-based API
- Clean and responsive UI
The model predicts one of the following emotions:
- Angry
- Disgusted
- Fear
- Happy
- Sad
- Surprise
- Neutral
emotion-detector/
│
├── backend/ # FastAPI backend
│ ├── main.py
│ ├── database.py
│ └── users.db # SQLite database (auto-created)
│
├── model/
│ └── face_model.h5 # Trained emotion detection model
│
├── src/ # React frontend
├── public/
│
├── ui-screenshots/ # UI images used in this README
│
├── package.json
└── README.md
- React (Create React App)
- Axios
- HTML / CSS / JavaScript
- FastAPI
- Uvicorn
- SQLite
- JWT Authentication
- Passlib (bcrypt)
- TensorFlow / Keras
- Convolutional Neural Network (CNN)
- Grayscale facial images (48×48)
- Python 3.11
- Node.js (LTS)
- npm
# From project root
python -m venv .venv
.venv\Scripts\activate # Windows
cd backend
pip install -r requirements.txt
uvicorn main:app --reloadhttp://127.0.0.1:8000
http://127.0.0.1:8000/docs
# From project root
npm install
npm starthttp://localhost:3000
- User signs up
- User logs in
- Backend returns a JWT token
- Token is stored client-side
- Authenticated requests include: Authorization: Bearer
- SQLite
- Database file:
users.db - Automatically created on first backend run
- Stores:
- Users
- Encrypted passwords
- Emotion analysis history
- Uploaded images (BLOBs)
- Emotion-aware applications
- Human-computer interaction demos
- AI-powered image analysis
- Portfolio and academic projects
- TensorFlow requires Python 3.10 or 3.11
- CPU inference supported (GPU optional)
- Image upload endpoints require authentication
- Real-time webcam emotion detection
- Face detection before emotion classification
- Improved confidence visualization
- Dockerized deployment
- Cloud hosting (AWS / GCP)


