Skip to content

Repository files navigation

RAG PDF Q&A

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

Run locally

pip install -r requirements.txt
export GROQ_API_KEY=gsk_...   # free key: https://console.groq.com/keys
streamlit run streamlit_app.py

Deploy free (Streamlit Community Cloud)

  1. Push this repo to GitHub.
  2. share.streamlit.io → New app → pick the repo, main file streamlit_app.py.
  3. 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
  4. Deploy. First build ~3–4 min (torch + sentence-transformers).

Notes

  • 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.

Screenshots

Upload and extract Question and answer Answer with sources

About

RAG over PDFs — MiniLM + FAISS retrieval, HF Inference LLM, answers cite sources. Streamlit app + notebook.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages