What's New in v2.0: Performance optimization with caching, export functionality, chat history and improved error handling.
PDF‑GPT v2.0 is a professional Streamlit application that lets you ask questions about your PDF files and generate summaries, practice questions, MCQs, and study notes. It uses Google Gemini 2.0 Flash for language reasoning, LangChain for text processing, and FAISS for vector search. Version 2.0 features a complete UI overhaul, performance optimizations, and new export capabilities.
- Multiple PDF upload and processing
- Chat over documents with Gemini 2.0 Flash
- Vector search using FAISS for relevant answers
- [NEW] Chat history with conversation tracking
- [NEW] Session state management
- Document summarization
- Question generation with answers
- MCQ generation
- Structured study notes
- Instant answers for quick lookups
- [NEW] Export functionality (download summaries, notes, MCQs as text files)
- Performance Optimization: Model and embeddings caching for faster responses
- Better UX: Improved error messages and user feedback
- Export Capability: Download generated content as text files
- Chat History: View previous Q&A sessions
- Code Quality: Removed unused imports, cleaner code structure
- UI: Streamlit
- PDF parsing: PyPDF2 (text extraction)
- Indexing: LangChain text splitters + FAISS vector store
- LLM: Google Gemini (via google-generativeai and langchain-google-genai)
- Config: .env for secrets and environment settings
git clone https://github.com/cu-sanjay/PDF-GPT.git
cd PDF-GPT
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in the project root:
# Required
GOOGLE_API_KEY=your_google_ai_api_key
# Optional
GEMINI_MODEL=gemini-2.0-flash
EMBEDDINGS_MODEL=text-embedding-004Get a free Google AI API key from Google AI Studio.
# Option A
streamlit run app.py
# Option B (works even if streamlit is not on PATH)
python -m streamlit run app.pyOpen http://localhost:8501 in your browser.
Use the button below to deploy your own copy on Render. Set the GOOGLE_API_KEY environment variable in the Render dashboard.
Start command (Render):
python -m streamlit run app.py --server.address=0.0.0.0 --server.port=$PORTEnvironment variables (Render):
GOOGLE_API_KEY(required)GEMINI_MODEL(optional, defaultgemini-2.0-flash)EMBEDDINGS_MODEL(optional, defaulttext-embedding-004)
- Push the repository to GitHub.
- Create a new app on Streamlit Cloud and select this repo.
- Main file:
app.py. - Add secrets in Settings → Secrets:
GOOGLE_API_KEY = "your_google_ai_api_key"
GEMINI_MODEL = "gemini-2.0-flash"
EMBEDDINGS_MODEL = "text-embedding-004"Do not commit the real
.env. Commit.env.exampleonly.
Local development:
python -m streamlit run app.pyContainer or PaaS environments:
python -m streamlit run app.py --server.address=0.0.0.0 --server.port=${PORT:-8501}- Python 3.8 or later
- A valid Google AI API key
- GOOGLE_API_KEY not found: create a
.envfile or set the variable on the host platform. - Streamlit not found: run with
python -m streamlit run app.pyand ensure dependencies are installed. - PDF cannot be read: the file may be image‑only or password protected.
- No text extracted: OCR is not included. Use text‑based PDFs or add OCR before upload.
- Large files: split large PDFs or process fewer files at a time.
- Cold start on Render: wait for the free instance to wake.
- PDFs are processed in memory during a session.
- Do not commit confidential files or keys.
- Review and follow your organisation policies when handling documents.
The project uses Google Gemini, LangChain, FAISS, and Streamlit.