Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .dockerignore +44 -2
- README.md +34 -42
- orchestration.py +1 -3
- requirements.txt +2 -1
.dockerignore
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
__pycache__
|
| 2 |
*.pyc
|
| 3 |
*.pyo
|
|
@@ -18,9 +23,46 @@ coverage.xml
|
|
| 18 |
.mypy_cache
|
| 19 |
.pytest_cache
|
| 20 |
.hypothesis
|
|
|
|
|
|
|
| 21 |
.DS_Store
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
*.swp
|
| 23 |
*.swo
|
| 24 |
*~
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git
|
| 2 |
+
.git
|
| 3 |
+
.gitignore
|
| 4 |
+
|
| 5 |
+
# Python
|
| 6 |
__pycache__
|
| 7 |
*.pyc
|
| 8 |
*.pyo
|
|
|
|
| 23 |
.mypy_cache
|
| 24 |
.pytest_cache
|
| 25 |
.hypothesis
|
| 26 |
+
|
| 27 |
+
# OS
|
| 28 |
.DS_Store
|
| 29 |
+
.DS_Store?
|
| 30 |
+
._*
|
| 31 |
+
.Spotlight-V100
|
| 32 |
+
.Trashes
|
| 33 |
+
ehthumbs.db
|
| 34 |
+
Thumbs.db
|
| 35 |
+
|
| 36 |
+
# IDE
|
| 37 |
+
.vscode
|
| 38 |
+
.idea
|
| 39 |
*.swp
|
| 40 |
*.swo
|
| 41 |
*~
|
| 42 |
+
|
| 43 |
+
# Documentation
|
| 44 |
+
*.md
|
| 45 |
+
!README.md
|
| 46 |
+
|
| 47 |
+
# Temporary files
|
| 48 |
+
*.tmp
|
| 49 |
+
*.temp
|
| 50 |
+
|
| 51 |
+
# Large files (if any)
|
| 52 |
+
*.zip
|
| 53 |
+
*.tar.gz
|
| 54 |
+
*.tar
|
| 55 |
+
*.rar
|
| 56 |
+
|
| 57 |
+
# Model files that will be downloaded
|
| 58 |
+
Models/*.keras
|
| 59 |
+
Models/*.h5
|
| 60 |
+
Models/*.pb
|
| 61 |
+
|
| 62 |
+
# Upload directories
|
| 63 |
+
uploads/*
|
| 64 |
+
!uploads/.gitkeep
|
| 65 |
+
|
| 66 |
+
# Local testing
|
| 67 |
+
test_images/
|
| 68 |
+
examples/
|
README.md
CHANGED
|
@@ -1,66 +1,58 @@
|
|
| 1 |
---
|
| 2 |
-
title: WBC Classification
|
| 3 |
emoji: 🩸
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: mit
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
-
#
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
## Supported Cell Types
|
|
|
|
| 16 |
- Basophil
|
| 17 |
- Eosinophil
|
| 18 |
- Lymphocyte
|
| 19 |
- Monocyte
|
| 20 |
- Neutrophil
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
## API Endpoints
|
| 23 |
|
| 24 |
-
|
| 25 |
-
``
|
| 26 |
-
|
| 27 |
-
``
|
|
|
|
| 28 |
|
| 29 |
-
##
|
| 30 |
-
```
|
| 31 |
-
POST /api/predict
|
| 32 |
-
```
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
|
| 39 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
Example response:
|
| 44 |
-
```json
|
| 45 |
-
{
|
| 46 |
-
"predictions": [
|
| 47 |
-
{
|
| 48 |
-
"filename": "image.jpg",
|
| 49 |
-
"prediction": "Monocyte",
|
| 50 |
-
"confidence": 0.9876,
|
| 51 |
-
"all_probabilities": {
|
| 52 |
-
"Basophil": 0.0012,
|
| 53 |
-
"Eosinophil": 0.0045,
|
| 54 |
-
"Lymphocyte": 0.0023,
|
| 55 |
-
"Monocyte": 0.9876,
|
| 56 |
-
"Neutrophil": 0.0044
|
| 57 |
-
}
|
| 58 |
-
}
|
| 59 |
-
],
|
| 60 |
-
"processing_time": 1.23
|
| 61 |
-
}
|
| 62 |
-
```
|
| 63 |
-
|
| 64 |
-
## Model Information
|
| 65 |
-
|
| 66 |
-
The model is trained to classify white blood cell images with high accuracy using convolutional neural networks.
|
|
|
|
| 1 |
---
|
| 2 |
+
title: WBC Classification
|
| 3 |
emoji: 🩸
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: mit
|
| 9 |
+
app_port: 7860
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# WBC Classification System
|
| 13 |
|
| 14 |
+
An AI-powered White Blood Cell (WBC) classification system that can identify different types of white blood cells from microscopic images.
|
| 15 |
+
|
| 16 |
+
## Features
|
| 17 |
+
|
| 18 |
+
- **Real-time Classification**: Upload images and get instant predictions
|
| 19 |
+
- **Batch Processing**: Process multiple images simultaneously
|
| 20 |
+
- **High Accuracy**: Deep learning model trained on medical imagery
|
| 21 |
+
- **User-friendly Interface**: Simple web interface for easy interaction
|
| 22 |
|
| 23 |
## Supported Cell Types
|
| 24 |
+
|
| 25 |
- Basophil
|
| 26 |
- Eosinophil
|
| 27 |
- Lymphocyte
|
| 28 |
- Monocyte
|
| 29 |
- Neutrophil
|
| 30 |
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
1. **Single Image**: Upload a single microscopic image for classification
|
| 34 |
+
2. **Batch Processing**: Upload multiple images for simultaneous processing
|
| 35 |
+
3. **View Results**: Get detailed predictions with confidence scores
|
| 36 |
+
|
| 37 |
## API Endpoints
|
| 38 |
|
| 39 |
+
- `GET /` - Main web interface
|
| 40 |
+
- `POST /api/predict` - Single image prediction
|
| 41 |
+
- `POST /api/predict_batch` - Batch image prediction
|
| 42 |
+
- `GET /api/health` - Health check
|
| 43 |
+
- `GET /api/model_info` - Model information
|
| 44 |
|
| 45 |
+
## Technical Details
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
- **Framework**: FastAPI with TensorFlow
|
| 48 |
+
- **Model**: Custom CNN architecture
|
| 49 |
+
- **Input**: 128x128 RGB images
|
| 50 |
+
- **Output**: Classification with confidence scores
|
| 51 |
|
| 52 |
+
## Development
|
| 53 |
+
|
| 54 |
+
Built for medical image analysis and research purposes. The model is trained on high-quality microscopic images of white blood cells.
|
| 55 |
+
|
| 56 |
+
## License
|
| 57 |
|
| 58 |
+
MIT License - See LICENSE file for details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orchestration.py
CHANGED
|
@@ -530,7 +530,7 @@ def main():
|
|
| 530 |
config = load_configuration()
|
| 531 |
|
| 532 |
# Update these paths according to your setup
|
| 533 |
-
MODEL_PATH = "
|
| 534 |
TEST_IMAGE_PATH = "/home/amit/White_blood_application/uploads" # Update this path
|
| 535 |
TEST_FOLDER_PATH = "/home/amit/White_blood_application/uploads" # Update this path
|
| 536 |
|
|
@@ -573,5 +573,3 @@ def main():
|
|
| 573 |
print("Update the file paths above to test with your actual data.")
|
| 574 |
print(f"{'='*60}")
|
| 575 |
|
| 576 |
-
if __name__ == "__main__":
|
| 577 |
-
main()
|
|
|
|
| 530 |
config = load_configuration()
|
| 531 |
|
| 532 |
# Update these paths according to your setup
|
| 533 |
+
MODEL_PATH = "Models/at_batch_size=32.D24E.keras" # Update this path
|
| 534 |
TEST_IMAGE_PATH = "/home/amit/White_blood_application/uploads" # Update this path
|
| 535 |
TEST_FOLDER_PATH = "/home/amit/White_blood_application/uploads" # Update this path
|
| 536 |
|
|
|
|
| 573 |
print("Update the file paths above to test with your actual data.")
|
| 574 |
print(f"{'='*60}")
|
| 575 |
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -14,4 +14,5 @@ opencv-python==4.8.1.78
|
|
| 14 |
|
| 15 |
# Data Science
|
| 16 |
matplotlib==3.9.2
|
| 17 |
-
pandas==2.1.3
|
|
|
|
|
|
| 14 |
|
| 15 |
# Data Science
|
| 16 |
matplotlib==3.9.2
|
| 17 |
+
pandas==2.1.3
|
| 18 |
+
huggingface-hub==0.17.3
|