Skip to content

adiancodes/medBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MedBot - Medical Document Q&A

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.

Features

  • 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.

System Architecture

  • 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.

Tech Stack

  • Language: Python
  • LLM / GenAI: Google Gemini API
  • Vector Database: FAISS
  • Frontend: Streamlit

How to set it up

  1. Make sure you have Python installed on your computer.
  2. Clone or download this project.
  3. Open your terminal or command prompt in the project folder and install the required packages:
pip install -r requirements.txt
  1. You will need a free Google Gemini API key. You can get one at: https://aistudio.google.com/app/apikey
  2. Create a file named .env in the project folder and add your key like this:
GEMINI_API_KEY=your_actual_api_key_here

How to run the app

Open your terminal in the project folder and run:

streamlit run app.py

The app will open automatically in your web browser.

Disclaimer

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.

About

A Retrieval-Augmented Generation (RAG) pipeline built with Python, FAISS, and Google Gemini to perform semantic Q&A on medical PDFs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages