MediBot is an intelligent, generative AI-based medical chatbot that provides accurate, context-aware responses to health-related queries. It integrates state-of-the-art large language models (LLMs) using Retrieval-Augmented Generation (RAG) and delivers real-time answers via an Android app built with WebView.
β οΈ Disclaimer: MediBot is an informational tool and not a substitute for professional medical advice, diagnosis, or treatment.
- π§ Powered by transformer-based LLMs (e.g., LLaMA-3.1-8B-Instruct)
- π Context-aware responses using FAISS + LangChain RetrievalQA
- π± Android frontend with React Native + WebView
- π Seamless Flask-based backend integration
- π Dynamic PDF ingestion and semantic embedding creation
- π Deployed via Hugging Face Inference API
flowchart TD
A[User Query via Android App] --> B[POST to Flask API]
B --> C[Retrieve Env Vars & Model Config]
C --> D[LangChain RetrievalQA Pipeline]
D --> E[Fetch Chunks from FAISS]
E --> F[Form Prompt + Context]
F --> G[Call HuggingFace InferenceClient]
G --> H[Generate & Return Answer]
H --> I[Display Response in Mobile UI]
subgraph Setup
J[Upload PDFs] --> K[Chunk Text] --> L[Embed with SentenceTransformer] --> M[FAISS Index]
end
M --> E
| Layer | Technology |
|---|---|
| Frontend | React Native, WebView, Expo Go |
| Backend | Flask, Python, LangChain, dotenv |
| Embedding | sentence-transformers, FAISS |
| LLM | Hugging Face InferenceClient (LLaMA) |
| Retrieval | LangChain RetrievalQA Chain |
| Storage | Local FAISS Vectorstore |
βββ medibot-app/ # Core logic for embedding + memory management
β βββ connect_memory_with_llm.py # Retrieval pipeline with LLM
β βββ create_memory_for_llm.py # Embedding medical PDFs into FAISS
β βββ file.gitignore
β βββ medibot.py # Main interface file
β βββ test.py
β βββ README.md
β βββ requirements.txt
β βββ data/ # PDF files for ingestion
β βββ vectorstore/ # FAISS index storage
β
βββ medibot-flask/ # Flask backend for serving the LLM pipeline
β βββ app.py # Flask API entrypoint
β βββ requirements.txt # Python dependencies
β βββ .gitignore
β βββ vectorstore/ # Shared FAISS index
β
βββ medibot-react-app/
β βββ medibot-app/ # React Native frontend
β βββ App.js # Root of the mobile app
β βββ app/ # Navigation and screen components
β βββ assets/ # Images, icons
β βββ components/ # UI components
β βββ constants/ # Static configs
β βββ hooks/ # React hooks
β βββ scripts/ # Any automation/util scripts
β βββ node_modules/
β βββ eas.json # Expo app config
β βββ app.json # Project manifest
β βββ package.json # JS dependencies
β βββ tsconfig.json # TypeScript config
β βββ README.md
git clone https://github.com/<your-username>/medibot.git
cd medibotcd medibot-flask
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txtCreate a .env file:
HF_TOKEN=your_huggingface_api_token
HUGGINGFACE_REPO_ID=meta-llama/Llama-3.1-8B-Instruct
DB_FAISS_PATH=vectorstore/db_faissThen run:
python app.pypython create_memory_for_llm.pycd ../medical-chatbot
npm install
npx expo startScan the QR code on Expo Go app to preview it on your phone.
Insert screenshots of:
- Use sample PDFs in the
/data/folder to simulate ingestion. - Try queries like:
- βWhat are the symptoms of dengue?β
- βHow to treat a mild fever?β
- Evaluate response speed, context relevance, and coherence.
- π Multi-turn chat memory
- π Multilingual input/output support
- π€ Speech-to-text and text-to-speech capabilities
- πΎ On-device inference using quantized models
- π Feedback loop + model fine-tuning dashboard
- Fork this repo
- Create a new branch (
git checkout -b feature/xyz) - Commit your changes (
git commit -m 'Add feature') - Push to the branch (
git push origin feature/xyz) - Create a pull request!
This project is licensed under the MIT License.
βΆοΈ Click to watch demo video

