CoolFace
Apppublic

mryamusa/medical-image-classifier

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
App README

Medical Image Classification API

This is a FastAPI application for medical image classification using deep learning models.

Features

  • Kidney Disease Detection: Classifies kidney images into 4 categories (Cyst, Normal, Stone, Tumor)
  • Brain MRI Analysis: Classifies brain MRI images into 4 categories (Glioma, Meningioma, No Tumor, Pituitary)
  • Web Interface: User-friendly web interface for image upload and prediction
  • REST API: RESTful API endpoints for programmatic access

Usage

Web Interface

  1. 1.Visit the application URL
  2. 2.Select an image file
  3. 3.Choose the appropriate model type (Kidney or Brain MRI)
  4. 4.Click "Analyze Image" to get predictions

API Endpoints

  • GET / - Web interface
  • POST /predict/kidney - Kidney disease prediction
  • POST /predict/brain - Brain MRI analysis
  • GET /health - Health check
  • GET /models/info - Model information

Example API Usage

python
import requests

# Upload image for kidney disease detection
with open('kidney_image.jpg', 'rb') as f:
    files = {'file': f}
    response = requests.post('http://your-app-url/predict/kidney', files=files)
    result = response.json()
    print(f"Prediction: {result['predicted_class']}")
    print(f"Confidence: {result['confidence']:.2%}")

Model Information

The application uses pre-trained deep learning models based on ResNet50 architecture:

  • Kidney Model: Detects kidney conditions from medical images
  • Brain Model: Analyzes brain MRI scans for tumor detection

Deployment

This application is designed to run on Hugging Face Spaces with Docker support.

Requirements

  • Python 3.9+
  • PyTorch
  • FastAPI
  • Pillow
  • NumPy

License

This project is for educational and research purposes.