The open-source code for my Medical AI Assistant deployed on Hugging Face Spaces
Python
2
5 commits
updated Apr 6, 2026
A fine-tuned TinyLlama 1.1B medical chatbot trained on a custom medical Q&A dataset using QLoRA β deployed live on HuggingFace Spaces with a Gradio UI.
π€ Live Demo Β· β¨ Features Β· π§ͺ Model Details Β· π Getting Started
MediBot AI is a domain-specific medical chatbot built by fine-tuning TinyLlama-1.1B-Chat on a custom medical_qa.csv dataset using QLoRA (Quantized Low-Rank Adaptation). It answers medical questions covering symptoms, diseases, drug information, general health advice, and more β all through a clean Gradio web interface deployed on HuggingFace Spaces.
This project demonstrates a full LLM fine-tuning pipeline: from dataset preparation β QLoRA training β adapter merging β Gradio deployment.
π€ https://huggingface.co/spaces/Prajwal4107k/My-Medical-AI-Assistant

Asking "What are the symptoms of diabetes?" β MediBot responds with a detailed, numbered breakdown of diabetes symptoms including hyperglycemia, numbness, blurred vision, and fatigue.

Multi-turn conversation on HuggingFace Spaces β the bot correctly answers "What is the average human temperature?" and provides detailed kidney disease symptom identification when asked.
| Property | Value |
|---|---|
| Base Model | TinyLlama/TinyLlama-1.1B-Chat-v0.6 |
| Fine-tuning Method | QLoRA (4-bit quantization + LoRA adapters) |
| Library | PEFT (Parameter Efficient Fine-Tuning) |
| Pipeline | text-generation |
| Training Data | medical_qa.csv (custom Medical Q&A dataset) |
| Chat Template | Jinja2 (chat_template.jinja) |
| Adapter Format | SafeTensors (adapter_model.safetensors) |
| Tags | lora, transformers, TinyLlama-adapter |
| Component | Technology |
|---|---|
| Base LLM | TinyLlama 1.1B Chat |
| Fine-tuning | QLoRA via PEFT + bitsandbytes |
| Training Script | fine_tune_qlora.py |
| Framework | HuggingFace Transformers |
| UI | Gradio |
| Deployment | HuggingFace Spaces |
| Language | Python 3.10+ |
| Data Format | CSV (medical_qa.csv) + JSON (dataset.json) |
My-Medical-AI-Assistant-Code/
β
βββ fine_tuned_model/ # Trained LoRA adapter files
β βββ adapter_config.json # LoRA adapter configuration
β βββ adapter_model.safetensors # Fine-tuned adapter weights
β βββ chat_template.jinja # Custom chat prompt template
β βββ special_tokens_map.json # Special tokens mapping
β βββ tokenizer.json # Tokenizer vocabulary
β βββ tokenizer.model # SentencePiece tokenizer model
β βββ tokenizer_config.json # Tokenizer configuration
β βββ README.md # Model card
β
βββ .gradio/
β βββ certificate.pem # Gradio SSL certificate
β
βββ app.py # Gradio app β chat interface
βββ fine_tune_qlora.py # QLoRA fine-tuning script
βββ medical_qa.csv # Medical Q&A training dataset
βββ dataset.json # Processed dataset in JSON format
βββ test_imports.py # Dependency verification script
βββ requirements.txt # Python dependencies
βββ README.md
medical_qa.csv β dataset.json
β
βΌ
ββββββββββββββββββββββββββββββββ
β fine_tune_qlora.py β
β β
β β’ Load TinyLlama-1.1B-Chat β
β β’ 4-bit quantization β
β β’ Attach LoRA adapters β
β β’ Train on medical Q&A β
β β’ Save adapter weights β
ββββββββββββββββ¬ββββββββββββββββ
β
βΌ
fine_tuned_model/
adapter_model.safetensors
β
βΌ
ββββββββββββββββββββββββββββββββ
β app.py β
β β
β β’ Load base model β
β β’ Merge LoRA adapter β
β β’ Apply chat template β
β β’ Launch Gradio UI β
ββββββββββββββββ¬ββββββββββββββββ
β
βΌ
βββββββββββββββββββββββ
β MediBot AI β β User asks medical question
β Gradio Chat UI β β LLM generates answer
βββββββββββββββββββββββ
β
βΌ
HuggingFace Spaces π€
(Public live deployment)
git clone https://github.com/prajwal5065/My-Medical-AI-Assistant-Code.git
cd My-Medical-AI-Assistant-Code
pip install -r requirements.txt
Core packages include:
transformers
peft
bitsandbytes
gradio
torch
accelerate
datasets
python test_imports.py
python fine_tune_qlora.py
β οΈ Requires a CUDA GPU. The script loads
medical_qa.csv, applies 4-bit quantization, trains LoRA adapters, and saves them tofine_tuned_model/.
python app.py
The MediBot AI interface will open at http://127.0.0.1:7860
No setup needed β just visit:
π€ https://huggingface.co/spaces/Prajwal4107k/My-Medical-AI-Assistant
MediBot AI is for informational and educational purposes only. It is NOT a substitute for professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare professional for medical decisions. Never ignore professional medical advice because of something this AI has said.
This project is licensed under the MIT License β see the LICENSE file for details.
Built with β€οΈ by Prajwal
π€ Try MediBot AI Live on HuggingFace Spaces
β Star this repo if you found it helpful!
The open-source code for my Medical AI Assistant deployed on Hugging Face Spaces
Python
2
5 commits
updated Apr 6, 2026
A fine-tuned TinyLlama 1.1B medical chatbot trained on a custom medical Q&A dataset using QLoRA β deployed live on HuggingFace Spaces with a Gradio UI.
π€ Live Demo Β· β¨ Features Β· π§ͺ Model Details Β· π Getting Started
MediBot AI is a domain-specific medical chatbot built by fine-tuning TinyLlama-1.1B-Chat on a custom medical_qa.csv dataset using QLoRA (Quantized Low-Rank Adaptation). It answers medical questions covering symptoms, diseases, drug information, general health advice, and more β all through a clean Gradio web interface deployed on HuggingFace Spaces.
This project demonstrates a full LLM fine-tuning pipeline: from dataset preparation β QLoRA training β adapter merging β Gradio deployment.
π€ https://huggingface.co/spaces/Prajwal4107k/My-Medical-AI-Assistant

Asking "What are the symptoms of diabetes?" β MediBot responds with a detailed, numbered breakdown of diabetes symptoms including hyperglycemia, numbness, blurred vision, and fatigue.

Multi-turn conversation on HuggingFace Spaces β the bot correctly answers "What is the average human temperature?" and provides detailed kidney disease symptom identification when asked.
| Property | Value |
|---|---|
| Base Model | TinyLlama/TinyLlama-1.1B-Chat-v0.6 |
| Fine-tuning Method | QLoRA (4-bit quantization + LoRA adapters) |
| Library | PEFT (Parameter Efficient Fine-Tuning) |
| Pipeline | text-generation |
| Training Data | medical_qa.csv (custom Medical Q&A dataset) |
| Chat Template | Jinja2 (chat_template.jinja) |
| Adapter Format | SafeTensors (adapter_model.safetensors) |
| Tags | lora, transformers, TinyLlama-adapter |
| Component | Technology |
|---|---|
| Base LLM | TinyLlama 1.1B Chat |
| Fine-tuning | QLoRA via PEFT + bitsandbytes |
| Training Script | fine_tune_qlora.py |
| Framework | HuggingFace Transformers |
| UI | Gradio |
| Deployment | HuggingFace Spaces |
| Language | Python 3.10+ |
| Data Format | CSV (medical_qa.csv) + JSON (dataset.json) |
My-Medical-AI-Assistant-Code/
β
βββ fine_tuned_model/ # Trained LoRA adapter files
β βββ adapter_config.json # LoRA adapter configuration
β βββ adapter_model.safetensors # Fine-tuned adapter weights
β βββ chat_template.jinja # Custom chat prompt template
β βββ special_tokens_map.json # Special tokens mapping
β βββ tokenizer.json # Tokenizer vocabulary
β βββ tokenizer.model # SentencePiece tokenizer model
β βββ tokenizer_config.json # Tokenizer configuration
β βββ README.md # Model card
β
βββ .gradio/
β βββ certificate.pem # Gradio SSL certificate
β
βββ app.py # Gradio app β chat interface
βββ fine_tune_qlora.py # QLoRA fine-tuning script
βββ medical_qa.csv # Medical Q&A training dataset
βββ dataset.json # Processed dataset in JSON format
βββ test_imports.py # Dependency verification script
βββ requirements.txt # Python dependencies
βββ README.md
medical_qa.csv β dataset.json
β
βΌ
ββββββββββββββββββββββββββββββββ
β fine_tune_qlora.py β
β β
β β’ Load TinyLlama-1.1B-Chat β
β β’ 4-bit quantization β
β β’ Attach LoRA adapters β
β β’ Train on medical Q&A β
β β’ Save adapter weights β
ββββββββββββββββ¬ββββββββββββββββ
β
βΌ
fine_tuned_model/
adapter_model.safetensors
β
βΌ
ββββββββββββββββββββββββββββββββ
β app.py β
β β
β β’ Load base model β
β β’ Merge LoRA adapter β
β β’ Apply chat template β
β β’ Launch Gradio UI β
ββββββββββββββββ¬ββββββββββββββββ
β
βΌ
βββββββββββββββββββββββ
β MediBot AI β β User asks medical question
β Gradio Chat UI β β LLM generates answer
βββββββββββββββββββββββ
β
βΌ
HuggingFace Spaces π€
(Public live deployment)
git clone https://github.com/prajwal5065/My-Medical-AI-Assistant-Code.git
cd My-Medical-AI-Assistant-Code
pip install -r requirements.txt
Core packages include:
transformers
peft
bitsandbytes
gradio
torch
accelerate
datasets
python test_imports.py
python fine_tune_qlora.py
β οΈ Requires a CUDA GPU. The script loads
medical_qa.csv, applies 4-bit quantization, trains LoRA adapters, and saves them tofine_tuned_model/.
python app.py
The MediBot AI interface will open at http://127.0.0.1:7860
No setup needed β just visit:
π€ https://huggingface.co/spaces/Prajwal4107k/My-Medical-AI-Assistant
MediBot AI is for informational and educational purposes only. It is NOT a substitute for professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare professional for medical decisions. Never ignore professional medical advice because of something this AI has said.
This project is licensed under the MIT License β see the LICENSE file for details.
Built with β€οΈ by Prajwal
π€ Try MediBot AI Live on HuggingFace Spaces
β Star this repo if you found it helpful!