Spaces:
Sleeping
A newer version of the Gradio SDK is available: 6.14.0
license: mit
title: Smilo
sdk: gradio
emoji: ๐
colorFrom: blue
colorTo: green
short_description: Real-Time Emotion Detection powered by PyTorch & OpenCV
sdk_version: 5.15.0
python_version: '3.10'
app_file: app.py
pinned: false
Smilo ๐
Real-Time Emotion Detection powered by PyTorch & OpenCV
Smilo is a lightweight, deep learning-based application that detects and classifies 7 facial emotions (Angry ๐ , Disgust ๐, Fear ๐จ, Happy ๐, Neutral ๐, Sad ๐, Surprise ๐ฎ) in real-time. It features both a local desktop interface and a beautiful web-based interactive demo!
๐ Getting Started
Clone the repository and navigate into the project directory:
git clone <repository-url> cd SmiloInstall the required dependencies:
pip install -r requirements.txt
๐ฎ How to Use
Smilo offers two distinct ways to interact with the emotion detection model:
1. Web Interface (Recommended)
Run a beautifully designed web app powered by Gradio. This interface supports uploading photos, capturing snapshots, or streaming live video directly from your webcam.
python app.py
After running, click the local link (e.g. http://127.0.0.1:XXXX) in your terminal to open it in your browser.
2. Desktop Application
Run the classic desktop script. This will instantly launch a video window using your webcam feed, drawing tracking boxes and emotion labels on detected faces.
python main.py
Press q or click the 'X' button on the video window to quit.
๐ง Model & Architecture
- Face Detection: Uses OpenCV's optimized Haar Cascades for rapid and highly-efficient face tracking.
- Emotion Recognition: A custom 3-layer Convolutional Neural Network (CNN) built with PyTorch, trained on 128x128 resolution RGB images.
- Performance: System logic utilizes frame-skipping and concurrent processing optimizations to ensure video feeds maintain a lag-free 30+ FPS true 'live' experience.
๐ ๏ธ Retraining the Model
If you wish to augment the model or train it from scratch:
- Ensure your dataset is prepared and sorted.
- Open and run the
Train_model.ipynbJupyter Notebook. - The notebook will automatically guide you through data loading, transformation, model training, and exporting the updated inference weights (
face_classifier.pth).
Notes
Ensure you have adequate lighting and a clear, frontal view of your face for the most accurate predictions!
License
See the LICENSE file for details.""