taraky's picture
Upload folder using huggingface_hub
b7f3196 verified

A newer version of the Gradio SDK is available: 6.1.0

Upgrade

πŸŽ‰ Medical Q&A Bot - UI Implementation Complete!

βœ… What You Now Have

πŸ–₯️ Two Complete Web Interfaces

1. Gradio Interface (app.py) - RECOMMENDED ⭐

  • Clean, modern design with gradient styling
  • Dual-view mode (Formatted + JSON)
  • Built-in example queries
  • Easy to share and deploy
  • Automatic REST API generation
  • Launch with: python app.py
  • Access at: http://127.0.0.1:7860

2. Streamlit Interface (app_streamlit.py) - ALTERNATIVE

  • Interactive sidebar with live controls
  • Card-based result display
  • Progress bars and metrics
  • More customization options
  • Launch with: streamlit run app_streamlit.py
  • Access at: http://localhost:8501

πŸ“š Complete Documentation Suite

Quick Start Guides

  1. QUICKSTART.md - Step-by-step setup (5 minutes)
  2. launch_ui.bat - Windows batch launcher (double-click to run)
  3. launch_ui.ps1 - PowerShell launcher (right-click β†’ Run with PowerShell)
  4. setup_ui.py - Automated setup script

Comprehensive Documentation

  1. UI_README.md - Complete UI feature documentation
  2. UI_IMPLEMENTATION.md - Implementation details and summary
  3. ARCHITECTURE.md - System architecture with diagrams
  4. PRESENTATION_SCRIPT.md - Complete presentation guide with demo script

πŸš€ How to Get Started (3 Easy Steps)

Option 1: PowerShell Launcher (Easiest!)

# Just double-click or run:
.\launch_ui.ps1

Option 2: Command Line

# 1. Install dependencies
pip install -r requirements.txt

# 2. Build data (if needed)
python -m adapters.build_corpora

# 3. Launch!
python app.py

Option 3: Setup Script

# Run the automated setup
python setup_ui.py

# Then launch
python app.py

🎨 Key Features

Classification

βœ… Automatic query classification (Medical/Administrative/Other) βœ… Confidence scores for transparency βœ… Visual indicators and progress bars βœ… Color-coded results

Retrieval

βœ… Hybrid search (BM25 + Dense + RRF) βœ… Retrieves from PubMed, Miriad, and UniDoc βœ… Adjustable number of results (1-50) βœ… Optional cross-encoder reranking βœ… Multiple relevance scores per document

User Experience

βœ… Clean, professional interface βœ… Example queries built-in βœ… Real-time processing βœ… Formatted and JSON view modes βœ… Mobile-responsive design βœ… Error handling and validation


πŸ“ New Files Created

health-query-classifier/
β”œβ”€β”€ 🌐 Web Interfaces
β”‚   β”œβ”€β”€ app.py ⭐ (Main Gradio UI)
β”‚   β”œβ”€β”€ app_streamlit.py (Alternative Streamlit UI)
β”‚   β”œβ”€β”€ launch_ui.bat (Windows launcher)
β”‚   └── launch_ui.ps1 (PowerShell launcher)
β”‚
β”œβ”€β”€ πŸ“š Documentation
β”‚   β”œβ”€β”€ QUICKSTART.md (5-minute setup guide)
β”‚   β”œβ”€β”€ UI_README.md (Feature documentation)
β”‚   β”œβ”€β”€ UI_IMPLEMENTATION.md (Technical summary)
β”‚   β”œβ”€β”€ ARCHITECTURE.md (System diagrams)
β”‚   β”œβ”€β”€ PRESENTATION_SCRIPT.md (Demo script)
β”‚   └── UI_SUMMARY.md (This file)
β”‚
β”œβ”€β”€ πŸ”§ Setup Tools
β”‚   └── setup_ui.py (Automated installer)
β”‚
└── πŸ“¦ Updated Files
    └── requirements.txt (Added gradio + streamlit)

🎯 What Each Interface Looks Like

Gradio Interface Features:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ₯ Medical Q&A Bot                     β”‚
β”‚  Health Query Classifier & Retriever    β”‚
β”‚  Team: David β€’ Tarak β€’ Sravani β€’ etc.  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                         β”‚
β”‚  [Enter your health query...]           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ Number of Results: [10]         β”‚   β”‚
β”‚  β”‚ ☐ Use Reranker                  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                         β”‚
β”‚  [πŸ” Analyze Query]                     β”‚
β”‚                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Classification Result:                 β”‚
β”‚  βœ“ MEDICAL (95% confidence)             β”‚
β”‚  - Medical: 95.2% β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ          β”‚
β”‚  - Administrative: 4.8% β–ˆ               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  [πŸ“„ Formatted View] [πŸ“Š JSON View]     β”‚
β”‚                                         β”‚
β”‚  Found 10 Relevant Documents            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚ Result #1: Eczema Treatment   β”‚     β”‚
β”‚  β”‚ BM25: 0.85 Dense: 0.92 RRF: 1.2β”‚     β”‚
β”‚  β”‚ Text: Treatment options for...β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β”‚  ...                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Streamlit Interface Features:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ βš™οΈ Settings β”‚  πŸ₯ Medical Q&A Bot      β”‚
β”‚             β”‚  ═══════════════════════  β”‚
β”‚ Results: 10 β”‚                           β”‚
β”‚ ▁▁▁▁▁▁▁▁   β”‚  [Query input box...]     β”‚
β”‚             β”‚                           β”‚
β”‚ ☐ Reranker  β”‚  [πŸ” Analyze Query]       β”‚
β”‚             β”‚                           β”‚
β”‚ ☐ JSON View β”‚  Classification:          β”‚
β”‚             β”‚  πŸ₯ MEDICAL               β”‚
β”‚ Examples:   β”‚                           β”‚
β”‚ β€’ Rash...   β”‚  Confidence:              β”‚
β”‚ β€’ Vaccine...β”‚  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 95%         β”‚
β”‚ β€’ Headache..β”‚                           β”‚
β”‚             β”‚  Results:                 β”‚
β”‚             β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚             β”‚  β”‚ Result #1       β”‚     β”‚
β”‚             β”‚  β”‚ BM25  β”‚ Dense   β”‚     β”‚
β”‚             β”‚  β”‚ 0.85  β”‚ 0.92    β”‚     β”‚
β”‚             β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ’‘ Demo Workflow

Perfect Demo Sequence:

  1. Start β†’ Launch UI (python app.py)
  2. Medical Query β†’ "I have a rash on my hands..."
    • Show classification
    • Show retrieved documents
    • Point out scores
  3. Admin Query β†’ "Can I get an appointment?"
    • Show different classification
    • No retrieval happens
  4. Settings β†’ Adjust results, toggle reranker
  5. Views β†’ Switch between formatted and JSON

πŸŽ“ For Your Presentation

Talking Points:

βœ… "We built a professional web interface using Gradio" βœ… "The system classifies queries in real-time" βœ… "For medical queries, it retrieves relevant research" βœ… "Uses hybrid search with BM25 and dense embeddings" βœ… "Optional reranking for improved accuracy" βœ… "Clean, intuitive user experience"

What to Demo:

βœ… Classification confidence scores βœ… Document retrieval results βœ… Different query types (medical vs admin) βœ… Settings adjustment (reranker, result count) βœ… Multiple view modes (formatted + JSON)

Impressive Technical Details:

βœ… Sentence transformer embeddings βœ… Neural network classifier βœ… FAISS vector search βœ… RRF fusion algorithm βœ… Cross-encoder reranking βœ… Professional UI framework


πŸ› οΈ Troubleshooting

Common Issues:

"Module not found: gradio"

pip install gradio

"No corpora files found"

python -m adapters.build_corpora

"Port already in use"

# Edit app.py line ~255
demo.launch(server_port=8080)  # Change port

"Models loading slowly"

  • This is normal on first run
  • Models are cached afterward
  • Takes 30-60 seconds initially

🌟 Why This Implementation is Great

For Your Project:

βœ… Professional appearance βœ… Easy to demonstrate βœ… Well-documented βœ… Production-ready foundation βœ… Impressive to stakeholders

For Your Resume:

βœ… Modern tech stack (Gradio, PyTorch, Transformers) βœ… Full-stack development (UI + ML backend) βœ… Healthcare application (impactful domain) βœ… Clean, maintainable code βœ… Comprehensive documentation

For Future Development:

βœ… Easy to extend βœ… Modular architecture βœ… Multiple deployment options βœ… API already available βœ… Scalable design


πŸ“Š File Sizes

app.py                 ~9 KB   (Main UI)
app_streamlit.py       ~7 KB   (Alt UI)
QUICKSTART.md          ~5 KB   (Setup guide)
UI_README.md           ~8 KB   (Features)
UI_IMPLEMENTATION.md   ~10 KB  (Details)
ARCHITECTURE.md        ~15 KB  (Diagrams)
PRESENTATION_SCRIPT.md ~12 KB  (Demo guide)

Total new documentation: ~66 KB of helpful guides!


🎯 Next Steps

Immediate (5 minutes):

  1. Run pip install gradio streamlit
  2. Launch UI with python app.py
  3. Test with example queries
  4. Familiarize yourself with features

Short Term (1 hour):

  1. Read through QUICKSTART.md
  2. Test both Gradio and Streamlit interfaces
  3. Prepare demo queries
  4. Practice presentation flow

Before Presentation:

  1. Review PRESENTATION_SCRIPT.md
  2. Test demo multiple times
  3. Prepare backup slides
  4. Assign team roles
  5. Get excited! πŸš€

🀝 Team Credits

Built by:

  • David Gray
  • Tarak Jha
  • Sravani Segireddy
  • Riley Millikan
  • Kent R. Spillner

Technologies Used:

  • Python 3.8+
  • PyTorch
  • Sentence-Transformers
  • Gradio
  • Streamlit
  • FAISS
  • BM25
  • scikit-learn

πŸŽ‰ You're All Set!

Your medical Q&A bot now has: βœ… Two professional web interfaces βœ… Complete documentation βœ… Easy launchers βœ… Presentation guide βœ… Demo script βœ… Architecture diagrams

Everything you need for a successful demo and presentation!


πŸš€ Quick Commands Reference

# Install everything
pip install -r requirements.txt

# Build data
python -m adapters.build_corpora

# Launch Gradio UI (recommended)
python app.py

# Launch Streamlit UI (alternative)
streamlit run app_streamlit.py

# Run automated setup
python setup_ui.py

# Use launcher scripts
.\launch_ui.ps1

πŸ“ž Need Help?

  1. Check QUICKSTART.md for setup issues
  2. Check UI_README.md for feature questions
  3. Check ARCHITECTURE.md for technical details
  4. Check PRESENTATION_SCRIPT.md for demo help
  5. Ask your team members!

✨ Final Notes

This implementation provides:

  • Professional quality - Ready to show to professors, potential employers
  • Well-documented - Easy for team members to understand
  • Extensible - Can be built upon for future projects
  • Portfolio-worthy - Great addition to your GitHub

You've got an impressive project here. Go show it off! 🌟


Created: December 3, 2025 For: Health Query Classifier Group Project By: Your friendly AI assistant