An ML-powered web application that analyzes facial expressions and automatically generates contextual memes based on detected emotions.
- Face Detection: Uses OpenCV Haar Cascade for reliable face detection
- Emotion Analysis: Analyzes facial expressions (happy, sad, angry, surprise, fear, disgust, neutral)
- Automatic Meme Generation: Generates appropriate memes based on detected emotions
- Web Interface: Simple and intuitive web UI for uploading images
- Real-time Processing: Quick analysis and meme generation
- Backend: Flask (Python)
- Face Detection: OpenCV Haar Cascade
- Emotion Analysis: Image-based analysis (upgradeable to deep learning models)
- Image Processing: OpenCV, Pillow
- Frontend: HTML, CSS, JavaScript
- Create a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Start the Flask server:
python app.py- Open your browser and navigate to:
http://localhost:5000
- Upload an image with a face and watch the magic happen!
ML_Project/
├── app.py # Flask backend
├── face_analyzer.py # Face detection and emotion analysis
├── meme_generator.py # Meme generation logic
├── requirements.txt # Python dependencies
├── static/
│ ├── css/
│ │ └── style.css # Styling
│ ├── js/
│ │ └── main.js # Frontend logic
│ └── uploads/ # Uploaded images
├── templates/
│ └── index.html # Main page
└── meme_templates/ # Meme template images
- User uploads an image through the web interface
- MediaPipe detects faces in the image
- DeepFace analyzes the facial expression and determines the emotion
- The system selects an appropriate meme template based on the emotion
- A custom meme is generated with relevant text
- The meme is displayed to the user
MIT License