haroonwaheed19/skinsightsystem
0
SkinSight AI Service ๐งด
Neural Inference Engine for Dermatological Classification
 
This microservice provides high-performance skin disease analysis using a hybrid deep learning architecture. It is built with FastAPI for low-latency inference and PyTorch for neural computation.
๐๏ธ Model Architecture
SkinSight employs a Hybrid Fusion Stack:
- EfficientNet-B3: Captures high-resolution spatial features and textures from skin scans.
- Swin Transformer (Tiny): Utilizes shift-window attention to capture global context and long-range dependencies across the lesion area.
- Adaptive Fusion Head: A custom neural head that dynamically weights features from both backbones based on the input complexity.
๐ API Endpoints
POST /analyze
Performs real-time neural inference on a skin image.
- Request Body:
{
"image_url": "https://...",
"image_base64": "data:image/jpeg;base64,..."
}- Response:
{
"status": "success",
"top1": { "disease": "Melanoma", "confidence": 0.92, "urgency": "HIGH" },
"top5": [...]
}POST /report
Generates a Clinical PDF Report.
- Request Body:
ReportRequest(Includes patient name, email, and diagnostic findings). - Response: Binary PDF data with
Content-Disposition: attachment.
GET /health
Returns system status, engine version, and uptime metrics.
๐ ๏ธ Performance & Security
- Standalone Reliability: Prioritizes local branding and research assets, ensuring full functionality in isolated Docker or Hugging Face environments.
- Scientific Reporting: Clinical results are enriched with 10+ localized research figures (
ai-service/research). - Asynchronous Inference: Uses Starlette's
run_in_threadpoolto prevent blocking the async loop. - Production Metadata: Includes optimized
.dockerignoreand.gitattributes(LFS) for tracking. - Asset Optimization: Integrated
optimize_branding.pyworkflow for production visuals. - Secure Model Loading: Implements
weights_only=Truefor internal.pthfiles.
๐ฆ Deployment (Hugging Face)
This service is optimized for Hugging Face Spaces using Docker:
- Dockerized Runtime: Multi-stage build with optimized ignore rules for minimal image size.
- GPU Optional: Optimized for both CUDA and fast CPU-based medical inference.
- Asset Portability: Maintains local clinical branding and research figures for standalone report generation.
- Git LFS: Tracks large neural weights (
.pth) and high-resolution clinical figures for efficient repository syncing.
๐๏ธ Development
python -m venv fyp
./fyp/Scripts/activate
pip install -r requirements.txt
python main.py