Spaces:
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:
- Project Overview
- Architecture & Technology Stack
- Dataset Information & Sources
- Environment Setup (7 steps)
- Complete Implementation (Configuration, Schemas, Models, etc.)
- Model Training
- Backend Implementation
- Frontend Implementation
- Testing & Validation
- Deployment Guide
- Troubleshooting
- Performance Metrics
- 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"
- Read: QUICK_START_5_MINUTES.md (5 min)
- Follow 5-step setup
- Done! You're running it
Scenario 2: "I want to build it from scratch"
- Read: COMPLETE_REPRODUCTION_GUIDE.md Overview section (10 min)
- Follow Environment Setup steps (15 min)
- Download datasets (30 min - passive download)
- Follow Implementation steps (60 min)
- Train model or use pre-trained (varies)
- Deploy using Deployment Guide (10 min)
- 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"
- Read: IMPLEMENTATION_DETAILS.md Overview section (10 min)
- Jump to specific component you need
- Read code + explanation
- Modify as needed
Scenario 4: "I'm deploying to production"
- Read: COMPLETE_REPRODUCTION_GUIDE.md β Deployment Guide (10 min)
- Follow deployment option (AWS/GCP/Azure/Docker/Hugging Face)
- Configure API keys and environment
- Run health checks
- 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
- QUICK_START_5_MINUTES.md β Get running
- Try the web interface
- Upload sample X-rays
Intermediate
- COMPLETE_REPRODUCTION_GUIDE.md β Understand architecture
- Review datasets section
- Set up local environment
- Download sample datasets
- Run basic tests
Advanced
- IMPLEMENTATION_DETAILS.md β Deep dive into code
- Modify preprocessing pipeline
- Retrain model with custom data
- Deploy to production
- 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
- Start Simple: Run live demo first, then local install
- Read Order: QUICK_START β COMPLETE_GUIDE β IMPLEMENTATION
- Keep Terminal Ready: You'll need to run many commands
- Internet Speed: Slow? Download datasets overnight
- GPU Helpful: Not required but makes training faster
- API Keys First: Get these before starting setup
- Test Early: Run health checks after each step
- Version Control: Keep .env out of git (it's in .gitignore)
- Monitor Progress: Check logs during training/deployment
- 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
Made with β€οΈ for healthcare in resource-limited settings