How sikandarsubhani/skincare_recommendation_system works
Project Type and Purpose
• This is a full-stack, Flask-based web application named “Skincare_recommendation_system.”
• It allows users to upload skin lesion images, runs them through pre-trained Keras/TensorFlow models, classifies the lesion type, and provides skincare recommendations.
• There is also an admin interface for monitoring predictions and viewing charts.
File Structure Analysis
• Top-level files
• run.py – application entry point
• req.txt – Python dependencies
• README.md – project title
• Core application directory: skin/
• admin_routes.py – admin-side endpoints
• routes.py – user-side endpoints (upload, prediction)
• forms.py – Flask-WTForms definitions for login/register/upload
• models.py – database ORM definitions (SQLite via skin.db)
• best_model.h5, dermnet_*.h5, skin.h5 – saved Keras models in root and skin/model/
• skin.db – SQLite database storing user info, predictions, logs
• Static assets: skin/static/assets/(css, js, img, vendor)
• Templates: skin/templates/(login.html, register.html, prediction.html, dashboard.html, admin_dashboard.html, Graph.html…)
• Upload storage: skin/upload/<lesion-type>/ – sample dataset or uploads
Key Architectural Insights from README
• We infer a classic MVC pattern (Flask controllers, Jinja2 views, models.py as data layer), integrated with a machine-learning inference component.
a. Main Components
• User Interface (Web browser)
• Frontend Layer
• Static web assets (CSS/JavaScript)
• Jinja2 templates (HTML views)
• Backend Layer (Flask application)
• run.py + Flask app factory
• Routes/controllers (routes.py, admin_routes.py)
• Form handling (forms.py)
• Business logic (prediction pipeline, recommendation logic)
• Machine-Learning Component
• Model loader (Keras/TensorFlow)
• Pre-trained .h5 files stored on disk
• Data Layer
• SQLite database (skin.db) via models.py
• File storage for uploads (skin/upload/)
• Optional External Services (if added later)
• Email service for notifications
• Cloud storage for large datasets
b. Relationships and Data Flows
1. User requests page → Web server (Flask)
2. Flask returns HTML via templates + static assets
3. User uploads image → HTTP POST to /predict route
4. Controller validates form → saves file to upload directory
5. Prediction pipeline loads image → passes to Keras model → inference result
6. Result persisted to SQLite (via models.py) → recommendation logic runs
7. Flask renders prediction.html with result → response to user
8. Admin flows query DB → generate charts → render Graph.html/dashboard
c. Architectural Patterns and Principles
• MVC: Controllers (routes), Views (templates), Models (models.py & DB)
• Separation of Concerns: ML code isolated in prediction functions.
• Layered architecture: Presentation → Application → ML Service → Data.
• Stateless HTTP requests, with state stored in DB or filesystem.
d. Key Technologies
• Python 3 & Flask (web framework)
• SQLite via SQLAlchemy or Flask-SQLAlchemy
• Keras/TensorFlow for model inference
• WTForms for form handling
• HTML5/CSS3/JavaScript for frontend
• Jinja2 templating