This Streamlit application allows users to chat with PDF documents using Google's Gemini AI model. Users can upload PDF files, process them, and then ask questions about the content of those PDFs.
- Extract text from PDFs
- Process and vectorize text for efficient querying
- Use Google's Gemini AI model for question answering
- Interactive chat interface
- Python 3.7+
- Streamlit
- PyPDF2
- LangChain
- FAISS
- Google GenerativeAI
- python-dotenv
- Clone this repository
- Install the required packages:
pip install streamlit pypdf2 langchain faiss-cpu google-generativeai python-dotenv
- Set up your Google API key in a
.env
file:GOOGLE_API_KEY=your_api_key_here
- Run the Streamlit app:
streamlit run chatpdf.py
- Upload PDF files using the sidebar
- Click "Submit & Process" to extract and vectorize the text
- Ask questions in the main text input field
- View AI-generated responses based on the PDF content
- PDF text extraction using PyPDF2
- Text chunking with LangChain's RecursiveCharacterTextSplitter
- Text embedding using Google's Generative AI Embeddings
- Vector storage and similarity search with FAISS
- Question answering using Google's Gemini Pro model and LangChain