An end-to-end AI-powered diagnostic assistant that analyzes skin images, detects 10 different categories of skin diseases using Deep Learning (Transfer Learning), and provides real-time, actionable medical recommendations using a Large Language Model (LLM).
- Accurate Image Classification: Utilizes a fine-tuned MobileNetV2 architecture to classify complex skin conditions.
- High Precision on Critical Diseases: Achieved 97% precision for Melanoma and 89% for Basal Cell Carcinoma, making it highly reliable for detecting critical skin cancers.
- LLM-Powered Insights: Integrates Gemini AI to generate detailed explanations, treatment recommendations, and next steps in a structured JSON format.
- Interactive UI: A user-friendly Streamlit frontend for seamless image uploading and result visualization.
- Robust API: A high-performance FastAPI backend capable of real-time inference.
- Containerized Deployment: Fully dockerized (frontend & backend) for consistent and isolated deployments.
The model was trained for 46 epochs (Early Stopping triggered to prevent overfitting) and evaluated on an independent test set.
Overall Metrics:
- Test Accuracy: 76.33%
- Test Loss: 0.0894
- Macro Avg F1-Score: 0.69
- Weighted Avg F1-Score: 0.76
Detailed Performance on Key Classes:
| Disease Category | Precision | Recall | F1-Score |
|---|---|---|---|
| Melanoma | 0.97 | 0.75 | 0.85 |
| Basal Cell Carcinoma (BCC) | 0.89 | 0.90 | 0.90 |
| Melanocytic Nevi (NV) | 0.88 | 0.94 | 0.91 |
| Benign Keratosis-like Lesions | 0.68 | 0.76 | 0.72 |
| Seborrheic Keratoses | 0.66 | 0.76 | 0.71 |
| Warts, Molluscum & Viral | 0.62 | 0.69 | 0.65 |
Note: The model demonstrates exceptional precision in distinguishing life-threatening conditions like Melanoma, while inflammatory conditions (like Eczema and Atopic Dermatitis) show moderate scores due to high visual similarity.
- Backend: Python, FastAPI, Uvicorn
- Frontend: Streamlit
- AI / ML Model: TensorFlow / Keras (MobileNetV2 Transfer Learning)
- LLM Integration: Google Gemini API
- Deployment: Docker, Docker Compose
├── main.py # FastAPI backend entry point
├── app.py # Streamlit frontend application
├── inference.py # Deep learning model prediction logic
├── llm_advisor.py # LLM prompt engineering and API logic
├── best_skin_model.keras # Saved trained model
├── requirements.txt # Python dependencies
├── Dockerfile.backend # Dockerfile for FastAPI
├── Dockerfile.frontend # Dockerfile for Streamlit
└── docker-compose.yml # Multi-container orchestration
## 🚀 How to Run the Project
### Method 1: Using Docker (Recommended)
Make sure Docker Desktop is installed and running on your machine.
1. Clone the repository.
2. Open your terminal in the project directory.
3. Run the following command:
```bash
docker compose up --build
- Access the Application:
http://localhost:8501 - Access the API Docs:
http://localhost:8000/docs
- Install dependencies:
pip install -r requirements.txt
- Start the Backend API (Terminal 1):
uvicorn main:app --reload --port 8000
- Start the Frontend UI (Terminal 2):
streamlit run app.py