CoolFace
Apppublic

JeevaMano/genai-clinical-qa-assistant

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿง  GenAI Clinical Q&A Assistant

A GenAI-powered clinical question-answering system that allows users to ask questions about medical PDFs, patient cases, or discharge notes โ€” and get accurate, natural language answers.


๐Ÿš€ Features

  • โ€”๐Ÿ” Semantic search over clinical documents using FAISS & Sentence Transformers
  • โ€”๐Ÿ’ฌ Question answering via FLAN-T5 (HuggingFace Inference API)
  • โ€”๐Ÿ“„ Upload your own medical PDFs for live querying
  • โ€”๐ŸŒ Frontend built with Streamlit (no React/Node required)
  • โ€”๐Ÿง  Custom-trained on real medical CSVs converted into PDF
  • โ€”โš™๏ธ Modular architecture using FastAPI, Python, and Hugging Face

๐Ÿ“ Project Structure

genai-clinical-qa/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ app.py                # FastAPI app for backend
โ”‚   โ”œโ”€โ”€ qa_engine.py          # Embedding + QA logic
โ”‚   โ”œโ”€โ”€ document_loader.py    # PDF text extraction
โ”‚   โ”œโ”€โ”€ embedding_store.py    # FAISS vector index
โ”œโ”€โ”€ frontend/
โ”‚   โ””โ”€โ”€ app.py                # Streamlit UI
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ clinical_docs/        # Sample/generated PDFs
โ”œโ”€โ”€ generate_pdfs_from_csv.py # Create PDFs from medical CSVs
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ .env                      # HuggingFace token (excluded from Git)

๐Ÿ›  Setup Instructions

bash
# 1. Clone the repository
git clone https://github.com/Jeeva-soul/genai-clinical-qa.git
cd genai-clinical-qa

# 2. Create and activate virtual environment
python -m venv venv
venv\Scripts\activate        # (Windows)
# or
source venv/bin/activate     # (macOS/Linux)

# 3. Install required packages
pip install -r requirements.txt

# 4. Add HuggingFace token to .env
echo HUGGINGFACEHUB_API_TOKEN=your_token_here > .env

# 5. Run the backend
uvicorn backend.app:app --reload

# 6. In a new terminal, run the Streamlit frontend
cd frontend
streamlit run app.py

๐Ÿ“ฌ Example API Request (Backend)

POST /ask
{
  "question": "What medications were prescribed?"
}

๐Ÿ’ป Streamlit UI Features

  • โ€”Elegant design with custom CSS
  • โ€”Real-time question box with loading spinner
  • โ€”Upload your own PDFs to instantly augment the knowledge base
  • โ€”Beautifully styled answer container

๐Ÿ“Š Dataset Used


๐Ÿงฉ Future Enhancements

  • โ€”๐Ÿงฌ Clinical entity tagging (ICD-10, SNOMED)
  • โ€”โ˜๏ธ Cloud deployment (Azure, Hugging Face Spaces)
  • โ€”๐Ÿ” Multiple LLM support (switch between APIs/local models)
  • โ€”๐Ÿ“ˆ Session history & PDF content preview

โš ๏ธ Security Note

Do not commit your .env or HuggingFace API keys to GitHub. They are automatically excluded using .gitignore.


๐Ÿ‘จโ€๐Ÿ’ป Author

Jeeva Manavalan ๐ŸŽ“ University of Texas at Arlington | Data Scientist | GenAI Enthusiast ๐Ÿ”— LinkedIn โ€ข GitHub


๐Ÿ“„ License

MIT License