Live demo: https://rag-pdf-chat-ar-russel.streamlit.app
Ask questions about a PDF and get answers grounded in the document, with the retrieved passages shown as sources.
Pipeline: pypdf text extraction → paragraph chunking → all-MiniLM-L6-v2
embeddings → FAISS cosine retrieval (top-4) → answer from Groq.
Two entry points:
| file | what |
|---|---|
streamlit_app.py |
deployable web app — runs free on Streamlit Community Cloud (CPU) |
RAG_PDF_QA.ipynb |
original notebook — same pipeline, generation with a local 4-bit Llama-2 + LoRA adapter |
pip install -r requirements.txt
export GROQ_API_KEY=gsk_... # free key: https://console.groq.com/keys
streamlit run streamlit_app.py- Push this repo to GitHub.
- share.streamlit.io → New app → pick the repo, main file
streamlit_app.py. - Advanced settings → Secrets:
GROQ_API_KEY = "gsk_..." # GROQ_API_KEY2 ... GROQ_API_KEY5 = "..." # optional, rotated on failure # GROQ_MODEL = "openai/gpt-oss-120b" # optional override
- Deploy. First build ~3–4 min (torch + sentence-transformers).
- No OCR — scanned/image-only PDFs won't index. Use a text-based PDF.
- The index lives in session state; it resets on reload.
- Swap the model via
GROQ_MODEL.


