Loading repository data…
Loading repository data…
Gustav-Proxi / repository
AI-DxMH is an AI-powered health assistant that provides accessible medical diagnoses for people in remote areas of India. It uses a large language model (LLM), natural language processing, and machine learning to ask users questions about their symptoms and provide likely diagnoses and health advice.
AI-DxMH ("Alfy") is a full-stack AI health assistant that lets patients in remote areas of India describe symptoms in plain language and receive a preliminary triage, likely diagnosis, and guidance on whether to seek in-person care. It targets regions with limited access to qualified physicians.
Core capabilities:
StableLM Zephyr 3B on a 16 000-sample medical Q&A corpus for domain adaptationDisclaimer: AI-DxMH is a research prototype. It is not a substitute for professional medical advice, diagnosis, or treatment.
flowchart LR
User(["Patient (browser)"])
FE["Next.js 14 Frontend\n(NextUI + Tailwind)"]
API["Edge API Route\n/api/chat"]
HF["HuggingFace Inference API\nOpenAssistant Pythia 12B"]
FT["Fine-tuned StableLM 3B\n(QLoRA / PEFT)"]
User -- "symptom message" --> FE
FE -- "POST /api/chat" --> API
API -- "HuggingFace stream" --> HF
HF -- "token stream" --> API
API -- "StreamingTextResponse" --> FE
FE -- "rendered reply" --> User
subgraph Offline Training
MedQA[("MedQuad dataset\n16 407 Q&A pairs")]
MedQA --> FT
end
cd "AI-DxMH FrontEnd"
npm install
Create a .env.local file:
HUGGINGFACE_API_KEY=hf_your_token_here
npm run dev
# → http://localhost:3000
Open Training_Code.ipynb in a GPU environment (tested on Google Colab with a T4/A100):
pip install -q bitsandbytes transformers peft accelerate datasets wandb
# Then run all cells in Training_Code.ipynb
The notebook fine-tunes stabilityai/stablelm-zephyr-3b with QLoRA (r=16, alpha=32) on the keivalya/MedQuad-MedicalQnADataset dataset and pushes the resulting adapter weights to HuggingFace Hub.
AI-DxMH-Artificial-Intelligence-Diagnosis-for-Modern-Health/
├── AI-DxMH FrontEnd/ # Next.js 14 web application
│ ├── app/
│ │ ├── page.tsx # Chat interface (main entry point)
│ │ └── api/chat/ # Edge streaming API route
│ ├── components/ # UI components (navbar, splash screen)
│ ├── config/ # Site config and fonts
│ └── public/ # Static assets (bot avatars)
├── Training_Code.ipynb # QLoRA fine-tuning notebook
├── G15FINALREPORT.pdf # Full project report
└── G15 Final Review PPT.pptx
| Setting | Value |
|---|---|
| Base model | stabilityai/stablelm-zephyr-3b |
| Dataset | keivalya/MedQuad-MedicalQnADataset (16 407 samples) |
| Method | QLoRA (4-bit NF4 quantization + LoRA) |
| LoRA rank / alpha | r=16, alpha=32 |
| Target modules | q, k, v, o projections + gate/up/down/lm_head |
| Trainable params | ~25.9 M / 1 552 M (1.67 %) |
| Training loss (1 epoch) | 0.5656 |
| Optimizer | paged_adamw_8bit |
| Sequence length | 512 tokens |
AI-DxMH: Artificial Intelligence Diagnosis for Modern Health Published in IJCRT (International Journal of Creative Research Thoughts), January 2024.
| Layer | Technology |
|---|---|
| Frontend | Next.js 14, NextUI, Tailwind CSS, TypeScript |
| Streaming | Vercel AI SDK, HuggingFace Inference |
| Inference model | OpenAssistant / oasst-sft-4-pythia-12b |
| Fine-tuning | HuggingFace PEFT, bitsandbytes, Accelerate |
| Training data | MedQuad Medical Q&A Dataset |