MedBot is a Python application that lets you upload medical PDF files and ask questions about them. It reads the document and uses AI to find the right answers based only on the text you provided.
- PDF Reading: Extracts text from your uploaded documents automatically.
- Smart Search: Breaks the text into small pieces and uses Facebook's FAISS library to quickly search through them.
- AI Answers: Uses Google's Gemini AI to read the relevant pieces of text and write a clear answer.
- Chat Interface: A simple, clean chat UI built with Streamlit.
- Source Tracking: Shows you exactly which parts of the PDF it used to generate the answer.
- Privacy First: Your PDF is processed locally on your machine. Only your specific questions and a few relevant paragraphs are sent to the AI.
- Document Processing: Ingests local PDF files and extracts raw text.
- Chunking & Vectorization: Splits the text into optimal semantic chunks and generates embeddings.
- Vector Store: Utilizes FAISS (Facebook AI Similarity Search) for high-speed, local similarity search and retrieval of relevant document chunks.
- LLM Integration: Passes the retrieved context and the user's query to the Google Gemini API to generate grounded, hallucination-free responses.
- User Interface: A conversational chat UI built entirely in Python using Streamlit.
- Language: Python
- LLM / GenAI: Google Gemini API
- Vector Database: FAISS
- Frontend: Streamlit
- Make sure you have Python installed on your computer.
- Clone or download this project.
- Open your terminal or command prompt in the project folder and install the required packages:
pip install -r requirements.txt- You will need a free Google Gemini API key. You can get one at: https://aistudio.google.com/app/apikey
- Create a file named
.envin the project folder and add your key like this:
GEMINI_API_KEY=your_actual_api_key_here
Open your terminal in the project folder and run:
streamlit run app.pyThe app will open automatically in your web browser.
This project was built for educational purposes and to demonstrate how to build AI tools. It is not designed to give medical advice or replace a doctor. Always consult a healthcare professional for medical concerns.