File size: 1,091 Bytes
4dbd6a3
1d76068
 
 
 
4dbd6a3
891e3ea
4dbd6a3
 
1d76068
4dbd6a3
 
1d76068
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: Real-Time Emotion Detection
emoji: 😊
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 6.5.1
app_file: app.py
pinned: false
license: mit
---

# 😊 Real-Time Emotion Detection

A deep learning app that detects human facial emotions from images using a **CNN trained with Keras/TensorFlow**, deployed via **Gradio** on Hugging Face Spaces.

## How to Use

1. Upload a photo **or** click the webcam icon to capture a live photo
2. The model will detect faces in the image
3. Each detected face will be labeled with the predicted emotion and confidence score

## Detectable Emotions

| Emotion    | Label |
|------------|-------|
| 😠 Angry   | 0     |
| πŸ˜„ Happy   | 1     |
| 😐 Neutral | 2     |
| 😒 Sad     | 3     |
| 😲 Surprised | 4   |

## Model Details

- **Architecture:** Custom CNN (3 Conv layers + Dense)
- **Input:** 48Γ—48 grayscale face image
- **Output:** Softmax probabilities over 5 emotion classes
- **Face Detection:** OpenCV Haar Cascade (`haarcascade_frontalface_default.xml`)

## Tech Stack

- TensorFlow / Keras
- OpenCV
- Gradio
- NumPy