Skip to content

WillVo1/UMaxAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Umax AI - Facial Analysis Website

A modern web application that provides AI-powered facial analysis and personalized looksmaxing recommendations using advanced computer vision and natural language processing.

🌟 Features

  • 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

πŸ“Š Analysis Metrics

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

πŸš€ Quick Start

Prerequisites

  • Python 3.8 or higher
  • OpenAI API key
  • Modern web browser

Installation

  1. Clone or download the project files

  2. Install Python dependencies:

    pip install -r requirements.txt
  3. 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
  4. Start the backend server:

    python start_server.py

    Or directly:

    python api.py
  5. Open the website:

    • Open index.html in your web browser
    • The website will automatically connect to the backend server

πŸ—οΈ Project Structure

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

🎯 Usage

  1. Start the Server: Run python start_server.py
  2. Open Website: Open index.html in your browser
  3. Upload Image: Drag and drop or click to select a photo
  4. Analyze: Click "Analyze Face" to process the image
  5. Review Results: View detailed analysis and personalized recommendations

πŸ“± API Endpoints

POST /analyze

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,..."
}

GET /health

Check server health and configuration status.

GET /

API information and available endpoints.

βš™οΈ Configuration

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

πŸ”§ Troubleshooting

Common Issues

  1. "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
  2. "OPENAI_API_KEY not set"

    • Set the environment variable: export OPENAI_API_KEY="your-key"
    • Restart the server after setting the key
  3. "No face detected"

    • Use a clear, front-facing photo
    • Ensure good lighting
    • Try a different image format (JPG, PNG)
  4. Dependencies missing

    • Run: pip install -r requirements.txt
    • Ensure Python 3.8+ is being used

Browser Compatibility

Tested on:

  • βœ… Chrome 90+
  • βœ… Firefox 88+
  • βœ… Safari 14+
  • βœ… Edge 90+

πŸ”’ Privacy & Security

  • 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

πŸ› οΈ Development

Adding New Features

  1. Backend: Modify pipeline components in their respective files
  2. Frontend: Update HTML, CSS, and JavaScript as needed
  3. API: Add new endpoints in api.py

Testing

# 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

πŸ“‹ Dependencies

Backend

  • Flask - Web framework
  • OpenAI - GPT integration
  • OpenCV - Image processing
  • InsightFace - Facial analysis
  • ChromaDB - Vector database
  • SentenceTransformers - Text embeddings
  • NumPy - Numerical computations

Frontend

  • Pure HTML/CSS/JavaScript
  • Font Awesome icons
  • Google Fonts (Inter)

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is for educational and research purposes. Please respect privacy and obtain consent before analyzing facial images.

πŸ†˜ Support

For issues or questions:

  1. Check the troubleshooting section
  2. Verify your setup matches the requirements
  3. Review server logs for error details
  4. Ensure all dependencies are properly installed

Built with ❀️ using AI and modern web technologies

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors