Spaces:
Build error
Build error
| title: Tuberculosis Detection ViT | |
| emoji: 🩺 | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: gradio | |
| sdk_version: 4.36.1 | |
| app_file: app.py | |
| pinned: false | |
| short_description: Classify chest X-ray images as Normal or Tuberculosis | |
| tags: | |
| - medical-imaging | |
| - tuberculosis-detection | |
| - vision-transformer | |
| - pytorch | |
| - gradio | |
| # 🩺 Tuberculosis Detection with Vision Transformer | |
| Classify chest X-ray images as **Normal** or **Tuberculosis** using a Vision Transformer (ViT) model. | |
| ## How to Use (Web Interface) | |
| - Upload a chest X-ray image (JPEG/PNG). | |
| - Click "Predict". | |
| - View the prediction, confidence score, and probabilities. | |
| ## How to Use (API) | |
| ### Standard Endpoint | |
| **URL**: `https://sukhmani1303-tuberculosis-vit-model.hf.space/api/predict/` | |
| **Method**: POST | |
| **Content-Type**: multipart/form-data | |
| **Input**: Image file (JPEG/PNG) | |
| **Output**: JSON response | |
| ```python | |
| import requests | |
| url = "https://sukhmani1303-tuberculosis-vit-model.hf.space/api/predict/" | |
| files = {"file": open("chest_xray.jpg", "rb")} | |
| response = requests.post(url, files=files) | |
| print(response.json()) | |
| ``` | |
| ### Raw Debug Endpoint | |
| **URL**: `https://sukhmani1303-tuberculosis-vit-model.hf.space/api/predict_raw/` | |
| **Method**: POST | |
| **Content-Type**: multipart/form-data | |
| **Input**: Image file (JPEG/PNG) | |
| **Output**: JSON response with raw debug information | |
| ```python | |
| import requests | |
| url = "https://sukhmani1303-tuberculosis-vit-model.hf.space/api/predict_raw/" | |
| files = {"file": open("chest_xray.jpg", "rb")} | |
| response = requests.post(url, files=files) | |
| print(response.json()) | |
| ``` | |
| ## Expected Response Format | |
| ```json | |
| { | |
| "status": "success", | |
| "prediction": "Normal", | |
| "confidence": 0.8542, | |
| "probabilities": { | |
| "Normal": 0.8542, | |
| "Tuberculosis": 0.1458 | |
| } | |
| } | |
| ``` | |
| ## Medical Disclaimer | |
| This tool is for **educational and research purposes only**. It is not intended for medical diagnosis. Always consult qualified healthcare professionals for medical advice and diagnosis. | |
| ## Model Information | |
| - **Architecture**: Vision Transformer (ViT) | |
| - **Task**: Binary classification (Normal vs Tuberculosis) | |
| - **Input**: Chest X-ray images | |
| - **Image Size**: 224x224 pixels | |