Spaces:
Runtime error
Runtime error
| # TB-Guard-XAI: Complete Documentation Suite | |
| This folder contains **three comprehensive guides** to help you replicate, understand, and deploy TB-Guard-XAI from scratch. | |
| --- | |
| ## π Guide Overview | |
| ### 1. **QUICK_START_5_MINUTES.md** β‘ | |
| **For: People who want to run it NOW** | |
| - β±οΈ **5-minute setup** - Get running immediately | |
| - π **Live demo link** - No installation required | |
| - π§ **Troubleshooting** - Common issues and fixes | |
| - π **Next steps** - What to do after setup | |
| **Start here if:** You just want to test the application quickly | |
| **Read time:** 5 minutes | |
| --- | |
| ### 2. **COMPLETE_REPRODUCTION_GUIDE.md** π | |
| **For: People who want to replicate the ENTIRE project** | |
| - ποΈ **Full architecture explanation** - How everything fits together | |
| - π **Dataset sources with links** - Exactly where to download data | |
| - π» **Complete environment setup** - Step-by-step configuration | |
| - π§ **All implementation code** - Key components included | |
| - π **Training instructions** - How to train models from scratch | |
| - π **Deployment options** - Local, Docker, Cloud, Hugging Face | |
| - β **Checklist** - Verify everything works | |
| **Sections included:** | |
| 1. Project Overview | |
| 2. Architecture & Technology Stack | |
| 3. Dataset Information & Sources | |
| 4. Environment Setup (7 steps) | |
| 5. Complete Implementation (Configuration, Schemas, Models, etc.) | |
| 6. Model Training | |
| 7. Backend Implementation | |
| 8. Frontend Implementation | |
| 9. Testing & Validation | |
| 10. Deployment Guide | |
| 11. Troubleshooting | |
| 12. Performance Metrics | |
| 13. Compliance & Regulatory | |
| **Start here if:** You want to understand and replicate the complete project | |
| **Read time:** 45 minutes | |
| **Use it as:** Reference guide during implementation | |
| --- | |
| ### 3. **IMPLEMENTATION_DETAILS.md** π | |
| **For: Developers who want LINE-BY-LINE code details** | |
| - π **Complete code implementations** - Every important function | |
| - π’ **Project structure** - File organization explained | |
| - π§ **Configuration system** - How settings work | |
| - π§ **Model architecture** - Ensemble implementation | |
| - π· **Preprocessing pipeline** - Image processing steps | |
| - π¨ **Grad-CAM++ implementation** - Visual explanation code | |
| - βοΈ **FastAPI backend** - Route definitions | |
| - ποΈ **Database/Storage** - Audit logging, rate limiting | |
| - π§ͺ **Testing framework** - Test examples | |
| - π **Running the app** - All execution options | |
| **Start here if:** You need to understand the exact implementation | |
| **Read time:** 60 minutes | |
| **Use it as:** Code reference while developing | |
| --- | |
| ## π― How to Use These Guides | |
| ### Scenario 1: "I just want to try it" | |
| 1. Read: **QUICK_START_5_MINUTES.md** (5 min) | |
| 2. Follow 5-step setup | |
| 3. Done! You're running it | |
| ### Scenario 2: "I want to build it from scratch" | |
| 1. Read: **COMPLETE_REPRODUCTION_GUIDE.md** Overview section (10 min) | |
| 2. Follow Environment Setup steps (15 min) | |
| 3. Download datasets (30 min - passive download) | |
| 4. Follow Implementation steps (60 min) | |
| 5. Train model or use pre-trained (varies) | |
| 6. Deploy using Deployment Guide (10 min) | |
| 7. Test using Testing section (10 min) | |
| **Total time:** 2-4 hours (depending on dataset download speed) | |
| ### Scenario 3: "I need to modify/understand the code" | |
| 1. Read: **IMPLEMENTATION_DETAILS.md** Overview section (10 min) | |
| 2. Jump to specific component you need | |
| 3. Read code + explanation | |
| 4. Modify as needed | |
| ### Scenario 4: "I'm deploying to production" | |
| 1. Read: **COMPLETE_REPRODUCTION_GUIDE.md** β Deployment Guide (10 min) | |
| 2. Follow deployment option (AWS/GCP/Azure/Docker/Hugging Face) | |
| 3. Configure API keys and environment | |
| 4. Run health checks | |
| 5. Monitor using Performance Metrics section | |
| --- | |
| ## π Quick Reference | |
| | Question | Answer | Read | | |
| |----------|--------|------| | |
| | How do I run it? | Follow 5-minute setup | QUICK_START_5_MINUTES.md | | |
| | Where are the datasets? | See Dataset Sources section | COMPLETE_REPRODUCTION_GUIDE.md | | |
| | How does the model work? | See Architecture section | COMPLETE_REPRODUCTION_GUIDE.md | | |
| | What's the exact code? | See IMPLEMENTATION_DETAILS.md | IMPLEMENTATION_DETAILS.md | | |
| | How do I train? | See Model Training section | COMPLETE_REPRODUCTION_GUIDE.md | | |
| | How do I deploy? | See Deployment Guide section | COMPLETE_REPRODUCTION_GUIDE.md | | |
| | What are the metrics? | See Performance Metrics section | COMPLETE_REPRODUCTION_GUIDE.md | | |
| | How do I fix errors? | See Troubleshooting section | COMPLETE_REPRODUCTION_GUIDE.md or QUICK_START_5_MINUTES.md | | |
| | What's the file structure? | See Project Structure section | IMPLEMENTATION_DETAILS.md | | |
| | How do I modify code? | See specific component in IMPLEMENTATION_DETAILS | IMPLEMENTATION_DETAILS.md | | |
| --- | |
| ## ποΈ File Organization | |
| ``` | |
| TB-Guard-XAI/ | |
| βββ QUICK_START_5_MINUTES.md β START HERE | |
| βββ COMPLETE_REPRODUCTION_GUIDE.md β Main reference | |
| βββ IMPLEMENTATION_DETAILS.md β Code details | |
| βββ README_GUIDES.md β This file | |
| βββ TB-Guard-XAI/ β Main project folder | |
| β βββ backend.py | |
| β βββ app.py | |
| β βββ config.py | |
| β βββ requirements.txt | |
| β βββ .env (create this) | |
| β βββ ... (all source files) | |
| βββ gradcam.py, mistral_explainer.py (top-level) | |
| ``` | |
| --- | |
| ## π Quick Setup Checklist | |
| - [ ] Read QUICK_START_5_MINUTES.md | |
| - [ ] Clone repository | |
| - [ ] Create virtual environment | |
| - [ ] Install requirements | |
| - [ ] Create .env file with API keys | |
| - [ ] Run `python backend.py` | |
| - [ ] Open http://localhost:7860 | |
| - [ ] Upload sample X-ray | |
| - [ ] View results | |
| --- | |
| ## π Document Features | |
| ### QUICK_START_5_MINUTES.md | |
| - β Live demo link | |
| - β 5-step installation | |
| - β Quick troubleshooting | |
| - β Next steps | |
| - β API examples | |
| ### COMPLETE_REPRODUCTION_GUIDE.md | |
| - β Full overview | |
| - β Complete architecture | |
| - β Dataset sources + links | |
| - β Step-by-step setup | |
| - β Code snippets | |
| - β Training instructions | |
| - β Deployment options | |
| - β Compliance info | |
| - β References + citations | |
| ### IMPLEMENTATION_DETAILS.md | |
| - β Project structure | |
| - β Configuration code | |
| - β Model architecture | |
| - β Preprocessing pipeline | |
| - β Grad-CAM++ code | |
| - β FastAPI routes | |
| - β Monitoring code | |
| - β Error handling | |
| - β Training script | |
| - β Testing framework | |
| --- | |
| ## π Learning Path | |
| ### Beginner | |
| 1. QUICK_START_5_MINUTES.md β Get running | |
| 2. Try the web interface | |
| 3. Upload sample X-rays | |
| ### Intermediate | |
| 1. COMPLETE_REPRODUCTION_GUIDE.md β Understand architecture | |
| 2. Review datasets section | |
| 3. Set up local environment | |
| 4. Download sample datasets | |
| 5. Run basic tests | |
| ### Advanced | |
| 1. IMPLEMENTATION_DETAILS.md β Deep dive into code | |
| 2. Modify preprocessing pipeline | |
| 3. Retrain model with custom data | |
| 4. Deploy to production | |
| 5. Monitor and optimize | |
| --- | |
| ## β¨ Key Topics Covered | |
| ### Setup & Configuration | |
| - Virtual environments | |
| - Dependency installation | |
| - API key configuration | |
| - Environment variables | |
| - Directory structure | |
| ### Understanding the Project | |
| - Architecture overview | |
| - System flow | |
| - Technology stack | |
| - Component interactions | |
| - Data pipeline | |
| ### Datasets | |
| - Where to download | |
| - How to prepare | |
| - Data splits | |
| - Preprocessing | |
| - Validation sets | |
| ### Implementation | |
| - Model architecture | |
| - Image preprocessing | |
| - Visual explanation (Grad-CAM++) | |
| - LLM integration | |
| - API endpoints | |
| - Frontend components | |
| ### Training & Evaluation | |
| - Training procedure | |
| - Hyperparameters | |
| - Validation metrics | |
| - Performance benchmarks | |
| - External validation | |
| ### Deployment | |
| - Local deployment | |
| - Docker containerization | |
| - Cloud deployment (AWS/GCP/Azure) | |
| - Hugging Face Spaces | |
| - Monitoring & logging | |
| ### Compliance | |
| - HIPAA audit logging | |
| - GDPR data handling | |
| - Privacy considerations | |
| - Regulatory pathways | |
| --- | |
| ## π Important Links | |
| ### Project | |
| - GitHub: https://github.com/vignesh19032005/TB-Guard-XAI | |
| - Live Demo: https://huggingface.co/spaces/mistral-hackaton-2026/TB-Guard-XAI | |
| - Paper: (Coming soon) | |
| ### Datasets | |
| - Shenzhen: https://data.lhncbc.nlm.nih.gov/public/Tuberculosis-Chest-X-ray-Datasets/ | |
| - Montgomery: https://data.lhncbc.nlm.nih.gov/public/Tuberculosis-Chest-X-ray-Datasets/ | |
| - TBX11K: https://academictorrents.com/details/07a9e9d43be209b1547f4829c9cb376f30551d6c | |
| - Kaggle TB: https://www.kaggle.com/datasets/tawsifurrahman/tuberculosis-tb-chest-xray-dataset | |
| - DA/DB: https://data.mendeley.com/datasets/8j2g3csprk | |
| ### API Services | |
| - Mistral AI: https://console.mistral.ai | |
| - Google Gemini: https://aistudio.google.com/app/apikey | |
| - Hugging Face: https://huggingface.co | |
| ### Technologies | |
| - FastAPI: https://fastapi.tiangolo.com | |
| - PyTorch: https://pytorch.org | |
| - TorchXRayVision: https://github.com/torchxrayvision/torchxrayvision | |
| --- | |
| ## π Getting Help | |
| ### Common Issues | |
| **Issue:** ModuleNotFoundError: No module named 'torch' | |
| β See QUICK_START_5_MINUTES.md Troubleshooting | |
| **Issue:** MISTRAL_API_KEY not found | |
| β See QUICK_START_5_MINUTES.md - Create .env file | |
| **Issue:** Port already in use | |
| β See QUICK_START_5_MINUTES.md Troubleshooting | |
| **Issue:** Can't find datasets | |
| β See COMPLETE_REPRODUCTION_GUIDE.md - Dataset Information | |
| **Issue:** Model inference slow | |
| β See COMPLETE_REPRODUCTION_GUIDE.md - Performance Metrics | |
| ### More Help | |
| - Check README.md for project overview | |
| - Review GitHub Issues | |
| - Check documentation in code comments | |
| --- | |
| ## π Version Info | |
| - **TB-Guard-XAI Version:** 3.0 | |
| - **Python Version:** 3.10+ | |
| - **Last Updated:** June 14, 2026 | |
| - **Status:** Production Ready | |
| --- | |
| ## π― What You'll Be Able to Do After Reading These Guides | |
| β Run TB-Guard-XAI locally or in the cloud | |
| β Understand the complete architecture | |
| β Replicate the project from scratch | |
| β Modify components for your needs | |
| β Train models with custom data | |
| β Deploy to production | |
| β Monitor and maintain the system | |
| β Contribute improvements | |
| β Build healthcare AI applications | |
| --- | |
| ## π‘ Pro Tips | |
| 1. **Start Simple:** Run live demo first, then local install | |
| 2. **Read Order:** QUICK_START β COMPLETE_GUIDE β IMPLEMENTATION | |
| 3. **Keep Terminal Ready:** You'll need to run many commands | |
| 4. **Internet Speed:** Slow? Download datasets overnight | |
| 5. **GPU Helpful:** Not required but makes training faster | |
| 6. **API Keys First:** Get these before starting setup | |
| 7. **Test Early:** Run health checks after each step | |
| 8. **Version Control:** Keep .env out of git (it's in .gitignore) | |
| 9. **Monitor Progress:** Check logs during training/deployment | |
| 10. **Save Output:** Keep results and metrics for reference | |
| --- | |
| ## π Acknowledgments | |
| - **WHO** for TB screening guidelines | |
| - **Mistral AI** for LLM access | |
| - **Google** for Gemini API | |
| - **Research Community** for TB datasets | |
| - **Healthcare Professionals** who guided requirements | |
| --- | |
| **Ready to get started? β [Open QUICK_START_5_MINUTES.md](QUICK_START_5_MINUTES.md)** | |
| **Made with β€οΈ for healthcare in resource-limited settings** | |