GitHunt
SH

shantanumohod23/pdf-chatbot-genai

๐Ÿค– A Generative AI chatbot that answers questions from PDFs using FLAN-T5 and sentence-transformers, built with Streamlit.

๐Ÿค– PDF Chatbot AI โ€” A Generative AI Application

A Generative AI-powered chatbot built with Streamlit that allows users to upload PDF documents and get detailed, human-like answers to their questions using state-of-the-art language models.


๐Ÿš€ Features

โœ… Upload and analyze PDF files ๐Ÿ“„
โœ… Extract and segment text using PyPDF2 + NLTK โœ‚๏ธ
โœ… Convert text into semantic embeddings using all-mpnet-base-v2 ๐Ÿ”
โœ… Retrieve the most relevant context based on user questions ๐Ÿง 
โœ… Generate context-aware answers using FLAN-T5-Large (Generative AI) โœจ
โœ… Clean and interactive UI with Streamlit ๐Ÿ’ฌ


๐Ÿ› ๏ธ Installation

1โƒฃ Clone the repository

git clone https://github.com/shantanumohod23/pdf-chatbot-ai.git
cd pdf-chatbot-ai

2โƒฃ Create and activate a virtual environment

# Windows
python -m venv .venv
.venv\Scripts\activate

# Mac/Linux
python3 -m venv .venv
source .venv/bin/activate

3โƒฃ Install dependencies

pip install -r requirements.txt

โ–ถ๏ธ How to Run

Once installed, start the Streamlit app:

streamlit run app.py

Upload a PDF file, ask your question, and let the AI generate an insightful answer! ๐Ÿค–๐Ÿ“š


๐Ÿ“ Folder Structure

๐Ÿ“‚ pdf-chatbot-ai
 โ”œโ”€โ”€ app.py            # Main Streamlit app
 โ”œโ”€โ”€ requirements.txt  # Required Python libraries
 โ”œโ”€โ”€ config.toml       # Streamlit config
 โ”œโ”€โ”€ README.md         # Project documentation
 โ”œโ”€โ”€ LICENSE           # License file

๐Ÿง  Technologies Used

  • Python ๐Ÿ
  • Streamlit โ€“ UI for interaction
  • PyPDF2 โ€“ PDF text extraction
  • NLTK โ€“ Sentence segmentation
  • Sentence Transformers โ€“ all-mpnet-base-v2 for semantic similarity
  • Hugging Face Transformers โ€“ google/flan-t5-large for generative responses

๐ŸŒฑ Future Improvements

โœ… Add support for scanned PDFs via OCR
โœ… Expand to handle multiple documents
โœ… Let users select different AI models
โœ… Deploy online via Hugging Face Spaces or Streamlit Cloud


๐Ÿ™‹โ€โ™‚๏ธ About the Creator

๐Ÿ“Œ Shantanu Mohod โ€“ Passionate about AI, Data Science, and Full-Stack Development
๐Ÿ”— GitHub: shantanumohod23
๐Ÿ”— LinkedIn: Shantanu Mohod