An interactive PDF question-answering app built with Streamlit, LangChain, and FAISS. Upload a PDF, index its content, ask questions, and get page-cited answers from the retrieved document text.
Try the deployed app here:
https://thageekiestone-pdf-rag-assistant-app-athfte.streamlit.app/
- Upload a PDF directly from the browser.
- Extract and split PDF text into overlapping chunks.
- Generate lightweight local hashing embeddings with no external model download.
- Store document vectors in FAISS for fast similarity search.
- Use MMR retrieval to reduce duplicate context chunks.
- Return extractive answers from the most relevant PDF sentences.
- Show page references and source snippets for transparency.
- Run locally or deploy on Streamlit Cloud.
| Area | Tools |
|---|---|
| UI | Streamlit |
| RAG workflow | LangChain |
| Vector search | FAISS |
| PDF parsing | PyPDF |
| Embeddings | Local hashing embeddings |
| Deployment | Streamlit Cloud |
- The user uploads a PDF.
PyPDFLoaderextracts page text from the file.- LangChain splits the text into overlapping chunks.
- Local hashing embeddings convert chunks into vectors.
- FAISS indexes the vectors.
- User questions are embedded and matched against the PDF index.
- The app returns the most relevant sentences with page citations.
Clone the repository:
git clone https://github.com/ThaGeekiestOne/pdf-rag-assistant.git
cd pdf-rag-assistantCreate and activate a virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Install dependencies:
pip install -r requirements.txtStart the app:
streamlit run app.pyThen open the local Streamlit URL, upload a PDF, click Index PDF, and start asking questions.
pdf-rag-assistant/
|-- app.py # Streamlit user interface
|-- rag_engine.py # PDF loading, chunking, FAISS retrieval, answer generation
|-- rag.py # Compatibility wrapper
|-- requirements.txt # Python dependencies
|-- packages.txt # Streamlit Cloud system dependency
|-- runtime.txt # Python runtime hint
`-- .streamlit/config.toml # Streamlit deployment config
This version is optimized for Streamlit Cloud reliability. It avoids large runtime LLM downloads and uses local embeddings plus extractive answers, which makes deployment faster and less memory-intensive.
- Add optional Hugging Face or API-based LLM answer generation.
- Persist FAISS indexes for repeated use.
- Support multiple PDFs at once.
- Add conversational memory.
- Add better ranking with rerankers or hybrid keyword/vector search.
Built by ThaGeekiestOne.