Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.3.0
metadata
title: Pdf RAG Chatbot
emoji: π’
colorFrom: gray
colorTo: yellow
sdk: gradio
sdk_version: 6.2.0
app_file: app.py
pinned: false
short_description: 'Chat with your pdf '
π PDF RAG Chatbot
A Retrieval Augmented Generation (RAG) chatbot that allows you to upload PDF documents and have conversations based on their content using AI.
Tech Stack
- UI: Gradio
- LLM: Groq (Llama 3.3 70B)
- Framework: LangChain
- Embeddings: HuggingFace (all-MiniLM-L6-v2)
- Vector Store: FAISS
- PDF Processing: PyPDF
Installation
- Clone the repository:
git clone <your-repo-url>
cd pdf-rag-chatbot
- Install dependencies:
pip install -r requirements.txt
- Set up your Groq API key:
export GROQ_API_KEY="your-api-key-here"
Get your free API key from Groq Console
Usage
- Run the application:
python app.py
Open your browser to the displayed URL (usually
http://localhost:7860)Upload a PDF file
Wait for processing to complete
Start asking questions about the PDF content!
How It Works
- PDF Processing: The uploaded PDF is split into smaller chunks
- Embedding: Each chunk is converted into a vector embedding
- Vector Storage: Embeddings are stored in FAISS for fast retrieval
- Query: When you ask a question, the system finds the most relevant chunks
- Response: The LLM generates an answer based on the retrieved context
Environment Variables
GROQ_API_KEY: Your Groq API key (required)
Deployment
Hugging Face Spaces
- Create a new Space on Hugging Face
- Upload all files
- Add
GROQ_API_KEYto Space secrets - Your app will be live!
Local Development
python app.py
Example Questions
After uploading a PDF, you can ask questions like:
- "What is the main topic of this document?"
- "Summarize the key points"
- "What does the document say about [specific topic]?"
- "Can you explain [concept] from the document?"