Spaces:
Sleeping
Sleeping
metadata
title: RAGnosis
emoji: π
colorFrom: red
colorTo: indigo
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: mit
short_description: Clinical Query Answering with RAG + MIMIC-IV Notes.
π©Ί RAGnosis β Clinical Reasoning via Retrieval-Augmented Generation
βοΈ A fully offline-capable, Gradio-powered RAG assistant trained on annotated clinical notes from the MIMIC-IV-Ext-DiReCT dataset to perform explainable diagnostic reasoning.
πΌοΈ Demo
Try it live on Hugging Face Spaces π
π https://huggingface.co/spaces/asadsandhu/RAGnosis
βοΈ Tech Stack
Layer | Details |
---|---|
π§ Model | Nous-Hermes-2-Mistral-7B-DPO |
π₯ Dataset | MIMIC-IV-Ext-DiReCT |
π Retriever | FAISS + SentenceTransformers (all-MiniLM-L6-v2 ) |
π» Frontend | Gradio (Hugging Face Spaces) |
π§ Backend | PyTorch + Transformers + BitsAndBytes |
π Features
- π Top-k document retrieval from real annotated clinical notes
- π Reasoning based on structured diagnostic chains
- π§ GPT-style generation from LLM (Mistral 7B) without internet dependency
- π§Ύ Clean Gradio interface for natural medical queries
- π§ Answers explained like a clinical reasoning expert
β‘ Example Prompt
Patient presents with fatigue, orthopnea, and lower extremity edema.
π¬ Model response:
Based on the patient's symptoms and context, the most likely diagnosis is congestive heart failure (CHF)...
π How It Works
β Step 1: Preprocessing
- Extract chains from
samples/
anddiagnostic_kg/
- Build retrievable clinical observations + diagnoses
β Step 2: Retrieval (FAISS)
- Embed notes using
MiniLM-L6-v2
- Save as FAISS index β
faiss_index.bin
- Paired with β
retrieval_corpus.csv
β Step 3: Generation
- Format prompt in
[INST]
syntax - Generate diagnosis using
Nous-Hermes-2-Mistral-7B-DPO
π§ͺ Run Locally
# 1. Clone the repository
git clone https://github.com/asadsandhu/RAG-Diagnostic-Assistant.git
cd RAG-Diagnostic-Assistant
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run the app
python app.py
βοΈ Required files:
π Folder Structure
RAG-Diagnostic-Assistant/
βββ app.py
βββ faiss_index.bin
βββ retrieval_corpus.csv
βββ requirements.txt
βββ assets/
β βββ demo.png
βββ README.md
π€ Author
Built with β€οΈ by Asad Ali π LinkedIn β @asadsandhu0 π Hugging Face β RAGnosis
π License
This project is under the MIT License.
π Acknowledgments
- MIMIC-IV-Ext-DiReCT: Annotated diagnostic data
- Hugging Face Transformers + Gradio
- Facebook Research β FAISS
- Nous Research β Instruction-tuned Mistral model
β οΈ Disclaimer: This project is for research/demo use only. Not intended for clinical decision-making.