CoolFace
Apppublic

haroonwaheed19/skinsightsystem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
App README

SkinSight AI Service ๐Ÿงด

Neural Inference Engine for Dermatological Classification

![Security Status](https://github.com/haroonwaheed19/skinsightsystem) ![Inference Status](https://github.com/haroonwaheed19/skinsightsystem)

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:

  1. 1.EfficientNet-B3: Captures high-resolution spatial features and textures from skin scans.
  2. 2.Swin Transformer (Tiny): Utilizes shift-window attention to capture global context and long-range dependencies across the lesion area.
  3. 3.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:
json
  {
    "image_url": "https://...",
    "image_base64": "data:image/jpeg;base64,..."
  }
  • โ€”Response:
json
  {
    "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_threadpool to prevent blocking the async loop.
  • โ€”Production Metadata: Includes optimized .dockerignore and .gitattributes (LFS) for tracking.
  • โ€”Asset Optimization: Integrated optimize_branding.py workflow for production visuals.
  • โ€”Secure Model Loading: Implements weights_only=True for internal .pth files.

๐Ÿ“ฆ Deployment (Hugging Face)

This service is optimized for Hugging Face Spaces using Docker:

  1. 1.Dockerized Runtime: Multi-stage build with optimized ignore rules for minimal image size.
  2. 2.GPU Optional: Optimized for both CUDA and fast CPU-based medical inference.
  3. 3.Asset Portability: Maintains local clinical branding and research figures for standalone report generation.
  4. 4.Git LFS: Tracks large neural weights (.pth) and high-resolution clinical figures for efficient repository syncing.

๐Ÿ—๏ธ Development

bash
python -m venv fyp
./fyp/Scripts/activate
pip install -r requirements.txt
python main.py