Spaces:
Sleeping
title: DermAI Skin Disease Classifier
emoji: π¬
colorFrom: blue
colorTo: blue
sdk: docker
pinned: false
license: mit
app_port: 7860
π¬ DermAI β Skin Disease Classifier
AI-Powered Dermatology Assistant
Upload a skin photo. Get an AI diagnosis in seconds.
π Table of Contents
- Overview
- Features
- Tech Stack
- Model Architecture
- Disease Classes
- Project Structure
- Local Setup
- API Reference
- Deployment
- Screenshots
- Disclaimer
- License
- Author
π§ Overview
DermAI is a full-stack AI-powered web application that classifies skin diseases from photographs using deep learning. Built with a fine-tuned ResNet-34 convolutional neural network trained via the fastai framework, it identifies 21 distinct skin conditions and provides detailed medical information, treatment options, and urgency flags for conditions requiring immediate attention.
The application features a FastAPI REST backend for model inference and a Streamlit multi-page frontend β both running concurrently inside a single Docker container deployed on Hugging Face Spaces.
β¨ Features
| Feature | Description |
|---|---|
| π¬ AI Diagnosis | Upload any skin photo and receive top-3 predictions with confidence scores |
| π Disease Encyclopedia | Detailed profiles for all 21 classifiable conditions |
| π₯ Dermatology Hub | Expert articles on skincare, sun protection, and dermatology tips |
| β οΈ Urgency Flags | Automatic red alerts for high-risk conditions (Skin Cancer, Actinic Keratosis) |
| π Dark UI | Modern dark-themed interface with responsive layout |
| β‘ Fast Inference | Direct tensor inference bypassing DataLoader threading issues |
| π³ Dockerized | Single-container deployment with supervisor managing both services |
π Tech Stack
Backend
- FastAPI β REST API framework
- Uvicorn β ASGI server
- fastai / PyTorch β Model loading and inference
- Pydantic β Data validation and serialization
Frontend
- Streamlit β Multi-page web interface
- Custom CSS β Dark theme with Orbitron + DM Sans typography
ML / Model
- Architecture: ResNet-34 (pretrained on ImageNet, fine-tuned)
- Framework: fastai 2.7
- Input Size: 448Γ448px (progressive resizing from 224β448)
- Output: Top-3 predictions with softmax confidence scores
Infrastructure
- Docker β Containerization
- Supervisor β Process management (FastAPI + Streamlit)
- Hugging Face Spaces β Cloud deployment
- Git LFS β Large file storage for model weights
π€ Model Architecture
Input Image (any size)
β
Resize to 448Γ448
β
Normalization (ImageNet stats)
β
ResNet-34 Backbone
(pretrained on ImageNet)
β
Custom Classification Head
β
Softmax (21 classes)
β
Top-3 Predictions + Confidence Scores
Training Details
- Base Model: ResNet-34 (ImageNet pretrained)
- Training Strategy: Progressive resizing (224 β 448)
- Framework: fastai with 1-cycle learning rate policy
- Augmentations: Random flip, rotation, zoom, lighting adjustments
- Optimizer: Adam with weight decay
π¦ Disease Classes
The model classifies the following 21 skin conditions:
| # | Medical Name | Category |
|---|---|---|
| 1 | Acne | Inflammatory |
| 2 | Rosacea | Inflammatory |
| 3 | Tinea (Ringworm) | Fungal |
| 4 | Candidiasis | Fungal |
| 5 | Warts | Viral |
| 6 | Eczema / Dermatitis | Inflammatory |
| 7 | Psoriasis | Autoimmune |
| 8 | Normal Skin | Healthy |
| 9 | Skin Cancer | Oncological β οΈ |
| 10 | Actinic Keratosis | Pre-Cancerous β οΈ |
| 11 | Benign Tumors | Growth |
| 12 | Bullous Disorders | Autoimmune |
| 13 | Drug Eruptions | Allergic |
| 14 | Infestations & Bites | Parasitic |
| 15 | Lichen Disorders | Inflammatory |
| 16 | Lupus-Related Conditions | Autoimmune |
| 17 | Moles (Nevi) | Growth |
| 18 | Seborrheic Keratoses | Growth |
| 19 | Vascular Tumors | Growth |
| 20 | Vasculitis | Inflammatory |
| 21 | Vitiligo | Autoimmune |
π Project Structure
dermAI/
βββ app/
β βββ backend/
β β βββ main.py # FastAPI app & endpoints
β β βββ model.py # Model loading & inference
β β βββ schemas.py # Pydantic models
β β βββ __init__.py
β βββ frontend/
β β βββ Home.py # Streamlit entry point
β β βββ styles.py # Global CSS injection
β β βββ .streamlit/
β β β βββ config.toml # Streamlit configuration
β β βββ pages/
β β βββ 1_Diagnosis.py # Image upload & prediction
β β βββ 2_Encyclopedia.py # Disease database browser
β β βββ 3_Dermatology_Hub.py # Articles & tips
β β βββ 4_About_FAQ.py # About & FAQ
β βββ data/
β βββ disease_info.py # Disease info database (21 conditions)
βββ skin_disease_classifier.pkl # Trained model weights (88MB, Git LFS)
βββ Dockerfile # Multi-service Docker container
βββ requirements.txt # Python dependencies
βββ README.md
π Local Setup
Prerequisites
- Python 3.12+
- Git LFS
- Conda (recommended) or virtualenv
1. Clone the repository
git clone https://github.com/yashvardhanshah/dermAI.git
cd dermAI
2. Create environment & install dependencies
conda create -n dermai python=3.12
conda activate dermai
pip install -r requirements.txt
3. Set environment variable (Windows)
set KMP_DUPLICATE_LIB_OK=TRUE
4. Start the FastAPI backend
cd app
uvicorn backend.main:app --reload --port 8000
5. Start the Streamlit frontend (new terminal)
cd app/frontend
streamlit run Home.py
6. Open in browser
- App: http://localhost:8501
- API Docs: http://localhost:8000/docs
π‘ API Reference
Base URL
https://huggingface.co/spaces/Yashvardhan1/dermaAI (production)
http://localhost:8000 (local)
Endpoints
GET /health
Health check β returns model load status.
{
"status": "ok",
"model_loaded": true,
"version": "1.0.0"
}
POST /predict
Upload a skin image and receive top-3 predictions.
Request: multipart/form-data with file field (JPEG/PNG/WEBP, max 15MB)
Response:
{
"top3": [
{
"label": "Acne",
"friendly_name": "Acne / Pimples",
"confidence": 0.8923
},
...
],
"disclaimer": "This tool is for educational purposes only..."
}
GET /diseases
Returns summary list of all 21 classifiable conditions.
GET /disease/{disease_key}
Returns full detail for a single condition including symptoms, causes, treatments, and when to see a doctor.
π³ Deployment
The app is deployed on Hugging Face Spaces as a Docker Space.
Architecture
Docker Container
βββ Supervisor (process manager)
β βββ FastAPI (port 8000) β model inference API
β βββ Streamlit (port 7860) β web UI (exposed)
βββ skin_disease_classifier.pkl β model weights
Deploy your own
- Fork this repository
- Create a new HuggingFace Space (Docker SDK)
- Push code to the Space repository
- The app builds and deploys automatically
β οΈ Medical Disclaimer
DermAI is an educational tool only and does NOT constitute medical advice.
This application is designed for informational and educational purposes. It should NOT be used as a substitute for professional medical diagnosis, advice, or treatment. Always consult a qualified dermatologist or healthcare professional for any skin concerns.
Results flagged as Skin Cancer or Actinic Keratosis should be evaluated by a medical professional immediately.
π License
This project is licensed under the MIT License β see the LICENSE file for details.
MIT License
Copyright (c) 2026 Yashvardhan Shah
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.
π€ Author
Yashvardhan Shah
β Star this repo if you found it useful!
Built with β€οΈ using FastAPI, Streamlit, and fastai