ktejeshnaidu commited on
Commit
7798715
·
verified ·
1 Parent(s): 1b4c83e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +98 -2
README.md CHANGED
@@ -2,12 +2,108 @@
2
  license: mit
3
  title: Smilo
4
  sdk: gradio
 
 
5
  emoji: 😃
6
  colorFrom: blue
7
  colorTo: green
8
  short_description: Real-Time Emotion Detection powered by PyTorch & OpenCV
 
9
  pinned: false
10
- sdk_version: 6.10.0
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: mit
3
  title: Smilo
4
  sdk: gradio
5
+ sdk_version: 6.10.0
6
+ python_version: '3.13'
7
  emoji: 😃
8
  colorFrom: blue
9
  colorTo: green
10
  short_description: Real-Time Emotion Detection powered by PyTorch & OpenCV
11
+ app_file: app.py
12
  pinned: false
 
13
  ---
14
 
15
+ # Smilo 😃
16
+ **Real-Time Emotion Detection powered by PyTorch & OpenCV**
17
+
18
+ Smilo is a lightweight, deep learning-based application that detects and classifies **7 facial emotions** in real-time:
19
+ 😠 Angry · 🤢 Disgust · 😨 Fear · 😃 Happy · 😐 Neutral · 😔 Sad · 😮 Surprise
20
+
21
+ It features a beautiful Gradio 6 web interface with **live webcam streaming**, **confidence score charts**, and instant upload detection.
22
+
23
+ ---
24
+
25
+ ## 🚀 Deploy to Hugging Face Spaces
26
+
27
+ > **Prerequisite:** Your model weights (`face_classifier.pth`) must be tracked with **Git LFS** (Large File Storage) before pushing, since the file is >100 MB.
28
+
29
+ ### Step 1 – Install Git LFS (once per machine)
30
+ ```bash
31
+ git lfs install
32
+ ```
33
+
34
+ ### Step 2 – Create a new Space
35
+ Go to [huggingface.co/new-space](https://huggingface.co/new-space), choose **Gradio** as the SDK, and clone the empty repo:
36
+ ```bash
37
+ git clone https://huggingface.co/spaces/<your-username>/Smilo
38
+ cd Smilo
39
+ ```
40
+
41
+ ### Step 3 – Track the model weights with LFS
42
+ ```bash
43
+ git lfs track "*.pth"
44
+ git add .gitattributes
45
+ ```
46
+
47
+ ### Step 4 – Copy your project files into the repo
48
+ ```
49
+ app.py
50
+ model.py
51
+ main.py
52
+ classes.pkl
53
+ face_classifier.pth ← large file, handled by LFS
54
+ requirements.txt
55
+ README.md
56
+ .gitattributes
57
+ ```
58
+
59
+ ### Step 5 – Commit and push
60
+ ```bash
61
+ git add .
62
+ git commit -m "🚀 Initial Smilo deployment"
63
+ git push
64
+ ```
65
+
66
+ Hugging Face will automatically build and serve your app — usually within 1–2 minutes. Visit your Space URL to see it live!
67
+
68
+ ---
69
+
70
+ ## 💻 Run Locally
71
+
72
+ ```bash
73
+ git clone <your-repo-url>
74
+ cd Smilo
75
+ pip install -r requirements.txt
76
+
77
+ # Web interface (Gradio 6, supports live webcam streaming)
78
+ python app.py
79
+
80
+ # Desktop OpenCV window
81
+ python main.py # press Q to quit
82
+ ```
83
+
84
+ ---
85
+
86
+ ## 🧠 Architecture
87
+
88
+ | Component | Details |
89
+ |-----------|---------|
90
+ | Face detection | OpenCV Haar Cascades (fast CPU inference) |
91
+ | Emotion model | Custom 3-layer CNN (PyTorch), 128×128 RGB input |
92
+ | Classes | 7 emotions |
93
+ | Interface | Gradio 6 with real-time webcam streaming & confidence scores |
94
+
95
+ ---
96
+
97
+ ## 🛠️ Retrain
98
+
99
+ Open `Train_model.ipynb` and follow the notebook. It will export updated `face_classifier.pth` and `classes.pkl`.
100
+
101
+ ---
102
+
103
+ ## 📝 Notes
104
+ - Ensure good frontal lighting for best accuracy.
105
+ - Free HF Spaces use CPU — inference is fast enough for smooth streaming.
106
+ - For GPU acceleration, upgrade the Space hardware in the HF settings.
107
+
108
+ ## License
109
+ MIT — see the LICENSE file for details.