A newer version of the Gradio SDK is available:
6.1.0
π Quick Start Guide - Medical Q&A Bot Web UI
This guide will help you get the web interface up and running quickly!
Prerequisites
- Python 3.8 or higher
- Git (already done since you have the repo)
- Virtual environment (recommended)
Step-by-Step Setup
1οΈβ£ Navigate to the Project Directory
cd "c:\Users\Tarak Jha\OneDrive - Coast to Coast Logistics\Desktop\HEALTHBOT\health-query-classifier"
2οΈβ£ Create and Activate Virtual Environment (Recommended)
# Create virtual environment
python -m venv .venv
# Activate it (Windows PowerShell)
.venv\Scripts\Activate.ps1
# If you get an execution policy error, run this first:
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
3οΈβ£ Install Dependencies
pip install -r requirements.txt
This will install:
- All existing dependencies (PyTorch, sentence-transformers, etc.)
- Gradio - For the web UI (recommended)
- Streamlit - Alternative web UI framework
4οΈβ£ Prepare Data (If Not Already Done)
python -m adapters.build_corpora
This creates the necessary corpus files from PubMed and Miriad databases.
5οΈβ£ Launch the Web UI
Option A: Gradio (Recommended)
python app.py
Then open: http://127.0.0.1:7860
Option B: Streamlit (Alternative)
streamlit run app_streamlit.py
Then open: http://localhost:8501
π― Choose Your UI
Gradio (app.py)
β Clean, modern interface β Dual-view (Formatted HTML + JSON) β Easy to share (can create public links) β Automatic API generation β Great for ML demos
Streamlit (app_streamlit.py)
β More interactive and customizable β Sidebar with settings β Real-time updates β Better for data science apps β More widgets and components
We recommend starting with Gradio! It's simpler and looks very professional.
π§ͺ Test with Example Queries
Try these queries to see the system in action:
Medical Query:
"I'm having a really bad rash on my hands. I'm pretty sure it's my eczema flaring up. Is there anything stronger than aquaphor I can use on it?"
Medical Emergency:
"worst headache of my life with fever and stiff neck"
Vaccine Question:
"I'm traveling to South America soon. Do I need to get any vaccines before I go?"
Administrative Query:
"Hey is there any way I can get an appointment in the next month?"
π¨ UI Features
Classification
- Shows whether query is medical, administrative, or other
- Displays confidence scores for each category
- Visual progress bars or charts
Document Retrieval (Medical Queries Only)
- Retrieves top N relevant documents
- Shows BM25, Dense, and RRF scores
- Displays document title, text preview, and metadata
- Toggle between formatted view and raw JSON
Settings
- Number of Results: 1-50 documents
- Use Reranker: Enable for better accuracy (slower)
π§ Troubleshooting
"No module named 'gradio'"
pip install gradio
"No corpora files found"
python -m adapters.build_corpora
Port Already in Use
Edit app.py and change the port:
demo.launch(server_port=8080) # Change 7860 to 8080
Models Not Loading
Make sure you have your HuggingFace token configured in env.list:
HF_TOKEN="your-huggingface-token"
π Advanced Options
Share Publicly (Gradio)
Edit app.py, line ~255:
demo.launch(share=True) # Creates a 72-hour public link
Add Authentication (Gradio)
demo.launch(auth=("username", "password"))
Change Theme (Streamlit)
Create .streamlit/config.toml:
[theme]
primaryColor = "#667eea"
backgroundColor = "#ffffff"
secondaryBackgroundColor = "#f0f2f6"
π± Accessing from Other Devices
To access from other devices on your network:
Find your IP address:
ipconfigLook for "IPv4 Address" (e.g., 192.168.1.100)
Edit
app.py:demo.launch(server_name="0.0.0.0", server_port=7860)Access from other device:
http://192.168.1.100:7860
π For Your Group Presentation
Demo Tips:
- Start with the interface loaded beforehand
- Have example queries ready
- Show both medical and administrative classification
- Demonstrate the reranker toggle
- Show both formatted and JSON views
- Explain the confidence scores
Screenshots to Take:
- Main interface
- Classification results
- Document retrieval results
- Settings panel
- Example queries
Key Points to Mention:
- Built with modern Python web frameworks
- Real-time classification and retrieval
- Hybrid search (BM25 + Dense embeddings)
- Optional reranking for accuracy
- Clean, professional interface
π Next Steps
Once you're comfortable with the UI, you can:
- Customize the styling (CSS in
app.py) - Add more example queries
- Integrate with other systems via the API
- Deploy to cloud (Hugging Face Spaces, AWS, etc.)
π€ Team Credits
Display proudly on the interface:
- David Gray
- Tarak Jha
- Sravani Segireddy
- Riley Millikan
- Kent R. Spillner
Need help? Check the full documentation in UI_README.md or ask your team members!