AI-Powered Skin Analysis & Personalized Product Recommendation System
Lumina (formerly LesionRec) is a modern, full-stack application that leverages advanced AI to analyze skin conditions and generate personalized skincare routines. It combines a privacy-focused image processing pipeline with a sophisticated recommendation engine to offer users actionable insights and product bundles that fit their budget.
This project has successfully reached Minimum Viable Product (MVP) status. It features a fully functional frontend, a robust backend API, and integrated AI services for real-time analysis.
The application is built using a modern decoupled architecture:
- Framework: React (Vite) with TypeScript
- Styling: Tailwind CSS for responsive, modern UI
- State Management: React Hooks + LocalStorage for persistence
- Key Components:
ImageUpload: Handles camera capture and file uploads.RecommendedProducts: Displays analysis results and product bundles.ProductRoutine: Visualizes the step-by-step skincare routine.
- Framework: FastAPI (Python)
- AI Services:
- Google Gemini 2.0 Flash: Primary engine for dermatological analysis (condition detection, severity assessment).
- Google Vision API: Used for privacy scrubbing (face detection/blurring) before analysis.
- Data Processing: Pandas for product dataset manipulation.
- Storage:
- S3 (AWS): Secure storage for uploaded images (presigned URLs).
- Local Data: Curated CSV datasets for skincare products.
- Privacy-First Analysis: All images are automatically scrubbed (faces blurred) to remove personally identifiable information before being stored or analyzed.
- Multi-Modal Input: Supports both file uploads and live camera capture.
- AI-Driven Insights: Detects conditions like Acne, Rosacea, Eczema, etc., and determines severity (Mild, Moderate, Severe).
- Smart Budgeting:
- Infinite Budget Mode: Defaults to showing the absolute best products.
- Dynamic Bundling: Users can set a specific budget (e.g., ), and the system recalculates the optimal "Bundle" (Cleanser + Treatment + Moisturizer) to fit the sum within that limit.
- Dual-List Recommendations:
- The Bundle: A cohesive routine where the total cost fits your budget.
- Individual Picks: A list of top-rated items where each item fits your budget.
- Persistence: Analysis results are saved locally, allowing page refreshes without re-uploading images.
backend/: Python FastAPI server and logic.frontend/: React application.archive/: Legacy code (Streamlit, YOLO models) and documentation.docs/: Current project documentation.start-dev.sh: Script to launch both frontend and backend.
main.py: The entry point for the FastAPI server. Defines endpoints/uploadand/recommend.services/:analysis.py: Handles interaction with Google Gemini API.privacy.py: Uses Google Vision API to detect and blur faces.product_recommender.py: The core logic engine. Contains the "Knapsack-style" algorithm for bundling and filtering logic.product_data_cleaner.py: Utilities for cleaning and loading CSV data.image_processor.py: Helper functions for image manipulation.
data/: Contains the CSV files for different skin conditions (e.g.,acne_products.csv,rosacea_products.csv).
App.tsx: Main application controller. Handles routing between Upload and Results views.components/:ImageUpload.tsx: Manages file selection, camera streaming, and API upload calls.RecommendedProducts.tsx: The results dashboard. Manages the budget state and displays the bundle/list.ProductRoutine.tsx: Renders the "Bundle" as a visual step-by-step card grid.
- User Action: User uploads an image or captures a photo via
ImageUpload.tsx. - Frontend: Sends
POST /uploadrequest with the image file to the Backend. - Backend (Privacy):
privacy.pydetects faces and blurs them. - Backend (Storage): Uploads the scrubbed image to AWS S3.
- Backend (AI Analysis):
analysis.pysends the scrubbed image to Gemini 2.0 Flash.- Prompt: "Analyze this skin image for conditions..."
- Response: JSON containing
condition(e.g., "acne"),severity, andcharacterization.
- Backend (Recommendation):
product_recommender.pytakes the analysis:- Loads the relevant product CSV (e.g.,
acne_products.csv). - Bundle Logic: Selects a Cleanser, Treatment, and Moisturizer such that
Sum(Prices) <= Budget. (Defaults to Infinite if no budget). - List Logic: Selects top-rated items where
Item_Price <= Budget.
- Loads the relevant product CSV (e.g.,
- Response: Backend returns the Analysis + Bundle + Recommendations to Frontend.
- Frontend:
App.tsxsaves data tolocalStorageand switches toRecommendedProducts.tsxview. - User Interaction: User enters a new budget (e.g., ).
- Update: Frontend calls
POST /recommendwith the existing analysis text and new budget. Backend recalculates and returns the new bundle.
- Node.js (v16+)
- Python (v3.9+)
- Google Cloud Credentials (for Vision & Gemini)
- AWS Credentials (for S3)
-
Clone the repository:
git clone https://github.com/adonisja/LesionRec.git cd LesionRec -
Environment Setup: Create a
.envfile in the root (orbackend/) with the following:GOOGLE_APPLICATION_CREDENTIALS="path/to/your/google-creds.json" GEMINI_API_KEY="your_gemini_key" AWS_ACCESS_KEY_ID="your_aws_key" AWS_SECRET_ACCESS_KEY="your_aws_secret" AWS_REGION="us-east-1" S3_BUCKET_NAME="your-bucket-name"
-
Run the Application: We have provided a convenience script to start both servers:
./start-dev.sh
This will start the Backend on
http://localhost:8000and the Frontend onhttp://localhost:5173.
Personal & Educational Use License
Copyright (c) 2025 Akkeem
This project is designed to be a learning resource and is available for personal and educational use only.
✅ You are free to:
- Download & Run: Install and run the application locally on your machine.
- Study & Learn: Review the source code to understand how the AI, Backend, and Frontend components work together.
- Modify: Experiment with the code for your own personal learning and hobby projects.
❌ You may NOT:
- Commercial Use: Use this source code, in whole or in part, for any commercial purpose, business, or revenue-generating activity.
- Redistribute for Profit: Sell, license, or monetize this code or any derivative works based on it.
If you wish to use this software for commercial purposes, please contact the author for permission.
This application is for educational and informational purposes only.
- Not Medical Advice: The analysis, insights, and product recommendations provided by Lumina are generated by Artificial Intelligence and are not a substitute for professional medical advice, diagnosis, or treatment.
- Consult a Professional: Always seek the advice of a physician or other qualified health provider with any questions you may have regarding a medical condition. Never disregard professional medical advice or delay in seeking it because of something you have read on this application.
- No Doctor-Patient Relationship: Use of this application does not create a doctor-patient relationship.
General Disclaimer
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.