mryamusa/medical-image-classifier
0
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
- Visit the application URL
- Select an image file
- Choose the appropriate model type (Kidney or Brain MRI)
- Click "Analyze Image" to get predictions
API Endpoints
GET /- Web interfacePOST /predict/kidney- Kidney disease predictionPOST /predict/brain- Brain MRI analysisGET /health- Health checkGET /models/info- Model information
Example API Usage
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.
