YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
Face Shape Analysis Application
This is a full-stack application that analyzes face shapes using AI. It consists of a Flask backend for face detection and analysis, and a Next.js frontend with two different result display components.
Features
- Face Shape Detection: Uses MediaPipe and a trained Random Forest model to detect face shapes (Heart, Oval, Round, Square)
- Dual Result Display:
- AnalysisCard: Beautiful, animated display with personality insights and styling recommendations
- ResultSection: Detailed facial measurements and technical data
- Real-time Processing: Processes uploaded images and displays results immediately
- Modern UI: Next.js frontend with beautiful animations and responsive design
Project Structure
Face_Detection/
βββ app.py # Flask backend with face analysis logic
βββ app/ # Next.js frontend
β βββ page.tsx # Main application page
β βββ api/ # API routes for frontend-backend communication
βββ components/ # React components
β βββ result-section.tsx # Detailed measurements display
β βββ analysis-card.tsx # Enhanced result display with personality insights
β βββ upload-section.tsx # File upload component
βββ uploads/ # Directory for uploaded images
βββ templates/ # Flask templates
βββ requirements.txt # Python dependencies
Setup Instructions
1. Install Python Dependencies
pip install -r requirements.txt
2. Install Node.js Dependencies
npm install
# or
pnpm install
3. Run the Application
Start the Flask Backend
python app.py
The Flask server will run on http://localhost:5000
Start the Next.js Frontend
npm run dev
# or
pnpm dev
The Next.js app will run on http://localhost:3000
How It Works
- Image Upload: Users upload images through the Next.js frontend
- Backend Processing: Flask backend processes images using MediaPipe face detection
- Face Shape Analysis: The trained Random Forest model predicts face shape
- Dual Display: Results are shown in two formats:
- AnalysisCard: Enhanced display with personality traits, characteristics, and styling advice
- ResultSection: Technical measurements and facial proportions
- Processed Images: Shows original image with facial landmarks and face shape label
API Endpoints
POST /analyze
- Analyzes a face image and returns face shape results with measurementsGET /uploads/<filename>
- Serves processed imagesPOST /upload
- Handles file uploads (Next.js API route)
Face Shapes Supported
- Heart: Wider forehead, pointed chin, romantic silhouette
- Oval: Balanced proportions, most versatile for styling
- Round: Soft curves, full cheeks, warm appearance
- Square: Strong jawline, defined angles, commanding presence
Components
AnalysisCard
- Beautiful animated display
- Personality insights and characteristics
- Styling recommendations
- Career compatibility suggestions
- Confidence meter and visual effects
ResultSection
- Detailed facial measurements
- Technical data (face length, cheekbone width, etc.)
- Processed image with landmarks
- Jaw curve ratio and proportions
Technologies Used
- Backend: Flask, MediaPipe, OpenCV, scikit-learn
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- AI/ML: Random Forest model for face shape classification
- Computer Vision: MediaPipe for facial landmark detection
Testing
Run the test script to verify the backend is working:
python test_setup.py
Notes
- Both result components display the same analysis data in different formats
- The AnalysisCard provides a more user-friendly, personality-focused experience
- The ResultSection provides detailed technical measurements for analysis
- All processed images are saved with landmarks drawn on them
- CORS is enabled for frontend-backend communication
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
1
Ask for provider support