Pdf-RAG-Chatbot / README.md
Bijay13's picture
updated README.md
0662542

A newer version of the Gradio SDK is available: 6.3.0

Upgrade
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

  1. Clone the repository:
git clone <your-repo-url>
cd pdf-rag-chatbot
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up your Groq API key:
export GROQ_API_KEY="your-api-key-here"

Get your free API key from Groq Console

Usage

  1. Run the application:
python app.py
  1. Open your browser to the displayed URL (usually http://localhost:7860)

  2. Upload a PDF file

  3. Wait for processing to complete

  4. Start asking questions about the PDF content!

How It Works

  1. PDF Processing: The uploaded PDF is split into smaller chunks
  2. Embedding: Each chunk is converted into a vector embedding
  3. Vector Storage: Embeddings are stored in FAISS for fast retrieval
  4. Query: When you ask a question, the system finds the most relevant chunks
  5. 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

  1. Create a new Space on Hugging Face
  2. Upload all files
  3. Add GROQ_API_KEY to Space secrets
  4. 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?"