PDF RAG Q&A App is an AI-powered web app that:
- π€ Accepts any PDF document,
- π Splits and embeds the content using
sentence-transformers+FAISS, - π€ Answers natural language questions using Groq-hosted LLaMA 3,
- π¬ Maintains a Q&A history β all in an interactive Streamlit interface.
- π PDF Text Extraction using
PyPDF2 - βοΈ Automatic Chunking for long documents
- π§ Embedding with
MiniLM(Hugging Face) - π Fast Semantic Search via
FAISS - π€ Answer Generation using LLaMA 3 on Groq
- π¬ Chat History tracked during session
- π Colab-Compatible UI with LocalTunnel link
pdf-rag-streamlit-groq/
β
βββ app.py # Streamlit UI
βββ rag_module.py # RAG logic: extraction, embeddings, query
βββ requirements.txt # All Python dependencies
βββ README.md # You're here!
Install all dependencies using:
pip install -r requirements.txt- Visit https://console.groq.com/keys
- Create a free account
- Click Create API Key β Give it a name β Submit
- Copy your key
Set your key as an environment variable (e.g. in Colab or .env):
GROQ_API_KEY_1=your_groq_api_key_here- Upload
app.py,rag_module.py, andrequirements.txtto a Colab notebook. - Install dependencies:
!pip install -r requirements.txt- Set your API key in another cell:
import os
os.environ['GROQ_API_KEY_1'] = "your_groq_api_key"- Add the code for
rag_module.pyandapp.pyusing%%writefile, then launch the app:
!wget -q -O - ipv4.icanhazip.com # Optional: View public IP
!streamlit run app.py & npx localtunnel --port 8501- Open the generated
.loca.ltlink to start chatting with your PDF! π
| Purpose | Model / Tool |
|---|---|
| Embedding Text | sentence-transformers/all-MiniLM-L6-v2 |
| Vector Search | FAISS (Flat L2 index) |
| Answer Generation | LLaMA3-8B-8192 hosted on Groq |
- π Support multiple PDFs in a single session
- π§Ύ Show which chunk or page the answer came from
- π₯ Export full Q&A history
- ποΈ Add voice input / narration
Zahra Batool :D