A modern web application that provides AI-powered facial analysis and personalized looksmaxing recommendations using advanced computer vision and natural language processing.
- AI-Powered Facial Analysis: Advanced facial attribute detection using InsightFace
- Personalized Recommendations: Custom looksmaxing plans generated by GPT-4
- Modern Web Interface: Responsive design with drag-and-drop image upload
- Real-time Processing: Fast analysis with visual feedback
- Privacy-Focused: Images are not stored on the server
The system uses advanced AI models to analyze comprehensive facial attributes:
- Beauty Score: Overall beauty assessment using specialized AI models
- Overall Attractiveness: Composite attractiveness score
- Skin Analysis:
- Skin clarity and texture quality
- Acne detection and severity assessment
- Overall skin health evaluation
- Hair Analysis:
- Hair health and density assessment
- Hair volume and quality analysis
- Hairline quality evaluation
- Additional Metrics: Age, gender, and other facial characteristics
- Python 3.8 or higher
- OpenAI API key
- Modern web browser
-
Clone or download the project files
-
Install Python dependencies:
pip install -r requirements.txt
-
Set up your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"
Or on Windows:
set OPENAI_API_KEY=your-api-key-here
-
Start the backend server:
python start_server.py
Or directly:
python api.py
-
Open the website:
- Open
index.htmlin your web browser - The website will automatically connect to the backend server
- Open
Umax2/
βββ π Frontend Files
β βββ index.html # Main website interface
β βββ styles.css # Website styling
β βββ script.js # Frontend JavaScript logic
β
βββ π§ Backend Components
β βββ api.py # Flask REST API server
β βββ pipeline.py # Main analysis pipeline
β βββ face_detector.py # Face detection using dlib
β βββ attribute_predictor.py # Facial analysis using InsightFace
β βββ rag_retriever.py # Knowledge base retrieval
β βββ plan_generator.py # AI-powered plan generation
β βββ config.py # Configuration settings
β
βββ π§ Utilities
β βββ utils.py # Helper functions
β βββ main.py # Command-line interface
β βββ start_server.py # Server startup script
β
βββ π Documentation
βββ README.md # This file
βββ requirements.txt # Python dependencies
- Start the Server: Run
python start_server.py - Open Website: Open
index.htmlin your browser - Upload Image: Drag and drop or click to select a photo
- Analyze: Click "Analyze Face" to process the image
- Review Results: View detailed analysis and personalized recommendations
Analyze a facial image and return detailed attributes and recommendations.
Request:
- Form data with image file
Response:
{
"success": true,
"detected_attributes": {
"attractiveness": 0.75,
"overall_score": 3.8,
"skin_clarity_score": 0.82,
"skin_texture_quality": 0.68,
"overall_skin_health": 0.75,
"acne_severity": 0.25,
"hair_health_score": 0.78,
"hair_density": 0.65,
"hair_volume": 0.70,
"overall_hair_score": 0.71,
"hairline_quality": 0.83,
"hair_type": "straight",
"hair_color": "brown",
"age": 25,
"gender": "Male"
},
"analysis": {
"status": "good",
"message": "You have one area to work on: Acne Severity.",
"strengths": [...],
"weaknesses": [...],
"advice": [...]
},
"personalized_plan": "## LOOKSMAXING PLAN\n...",
"face_crop_b64": "data:image/jpeg;base64,..."
}Check server health and configuration status.
API information and available endpoints.
Key settings can be modified in config.py:
class Config:
# API Configuration
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
OPENAI_MODEL = "gpt-4o-mini"
# Analysis Settings
FACE_SIZE = (224, 224)
LOW_THRESHOLD = 0.4
HIGH_THRESHOLD = 0.7
# Server Settings
API_PORT = 5000
DEBUG_MODE = True-
"Cannot connect to backend server"
- Ensure the Flask server is running (
python api.py) - Check if port 5000 is available
- Verify no firewall is blocking the connection
- Ensure the Flask server is running (
-
"OPENAI_API_KEY not set"
- Set the environment variable:
export OPENAI_API_KEY="your-key" - Restart the server after setting the key
- Set the environment variable:
-
"No face detected"
- Use a clear, front-facing photo
- Ensure good lighting
- Try a different image format (JPG, PNG)
-
Dependencies missing
- Run:
pip install -r requirements.txt - Ensure Python 3.8+ is being used
- Run:
Tested on:
- β Chrome 90+
- β Firefox 88+
- β Safari 14+
- β Edge 90+
- No Data Storage: Images are processed in memory and not saved
- Secure Transmission: All API calls use standard HTTP security
- Local Processing: Face detection happens on your server
- API Key Protection: OpenAI key is server-side only
- Backend: Modify pipeline components in their respective files
- Frontend: Update HTML, CSS, and JavaScript as needed
- API: Add new endpoints in
api.py
# Test backend components
python main.py path/to/test/image.jpg
# Test API directly
curl -X POST -F "image=@test.jpg" http://localhost:5000/analyze- Flask - Web framework
- OpenAI - GPT integration
- OpenCV - Image processing
- InsightFace - Facial analysis
- ChromaDB - Vector database
- SentenceTransformers - Text embeddings
- NumPy - Numerical computations
- Pure HTML/CSS/JavaScript
- Font Awesome icons
- Google Fonts (Inter)
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is for educational and research purposes. Please respect privacy and obtain consent before analyzing facial images.
For issues or questions:
- Check the troubleshooting section
- Verify your setup matches the requirements
- Review server logs for error details
- Ensure all dependencies are properly installed
Built with β€οΈ using AI and modern web technologies