This project is an academic demonstration of integrating multiple fine tuned Large Language Models (LLMs) into a single interactive chat interface. Developed using Streamlit and the Hugging Face Inference API, the application enables users to evaluate and compare responses generated by custom models fine tuned on medical and mental health datasets.
The primary objective of this project was to explore the end to end workflow of LLM fine tuning, model hosting and inference, while providing a simple interface for testing and comparing specialized models.
Built with: Python • Streamlit • Hugging Face Inference API • Transformers
Large Language Models can be adapted to specialized domains through fine tuning on domain specific datasets. In this project, multiple open source language models were fine tuned for medical and mental health tasks and integrated into a unified interface for evaluation.
Rather than serving as a production chatbot, this application was developed for academic and research purposes to demonstrate how fine tuned language models can be deployed through an inference API and accessed using a lightweight web interface.
The project was designed to:
- Explore the fine-tuning workflow for domain specific language models.
- Integrate multiple fine tuned models into a single application.
- Compare responses generated by different models.
- Demonstrate inference using the Hugging Face Inference API.
- Provide a simple interface for testing and evaluating model outputs.
- Interactive chat interface built with Streamlit.
- Selection between multiple fine tuned language models.
- AI generated responses using the Hugging Face Inference API.
- Session based conversation history.
- Download chat responses as text files.
- User friendly interface for comparing model outputs.
- Error handling for failed API requests.
flowchart LR
A[User]
-->B[Streamlit Interface]
B-->C[Hugging Face Inference API]
C-->D[Fine-Tuned Medical Models]
D-->E[Generated Response]
E-->B
- The user selects one of the available fine tuned language models.
- A prompt is entered through the Streamlit interface.
- The application sends the prompt to the selected model using the Hugging Face Inference API.
- The fine tuned model generates a response.
- The response is displayed in the chat interface and stored in the current session history.
The following models were developed as part of this project and published on Hugging Face.
| Model | Domain | Description |
|---|---|---|
| Llama-3.2-1B LoRA Fine Tune | Medical | Fine tuned for answering general medical questions. |
| Gemma Mental Health Fine Tune | Mental Health | Fine tuned for mental health and well being related conversations. |
| Qwen-1.5B Medical QA | Medical QA | Fine tuned for medical question answering tasks. |
medical-ai-chat/
├── app.py
├── requirements.txt
├── assets/
├── screenshots/
├── models/
├── README.md
└── ...
| Category | Technology |
|---|---|
| Language | Python |
| Frontend | Streamlit |
| Model Hosting | Hugging Face Hub |
| Inference | Hugging Face Inference API |
| LLM Framework | Transformers |
| API Communication | Requests |
git clone https://github.com/yourusername/medical-ai-chat-interface.git
cd medical-ai-chat-interfacepython -m venv venvWindows
venv\Scripts\activateLinux / macOS
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root.
HF_API_KEY=YOUR_HUGGING_FACE_API_KEYstreamlit run app.pyUser Prompt
│
▼
Select Fine Tuned Model
│
▼
Hugging Face Inference API
│
▼
Model Inference
│
▼
Generated Response
│
▼
Displayed in Streamlit Interface
This project was developed as part of an academic exploration of Large Language Model fine tuning and inference. It demonstrates how custom trained models can be integrated into a lightweight application for experimentation and evaluation.
The project is intended for educational and research purposes and should not be considered a production-ready medical assistant or a source of professional medical advice.
- Support additional fine tuned language models.
- Local inference without external APIs.
- Streaming response generation.
- Response evaluation metrics.
- Conversation export in multiple formats.
- Retrieval Augmented Generation (RAG) integration.
- Deployment using containerized infrastructure.
This project is licensed under the MIT License.