File size: 1,269 Bytes
be598b9
 
 
 
 
 
 
 
 
 
24111c8
be598b9
24111c8
be598b9
24111c8
be598b9
24111c8
be598b9
24111c8
be598b9
24111c8
be598b9
 
 
 
 
24111c8
be598b9
24111c8
be598b9
 
 
24111c8
be598b9
 
 
 
 
 
 
 
 
24111c8
be598b9
24111c8
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: RagBot
emoji: πŸ“š
colorFrom: indigo
colorTo: blue
sdk: streamlit
sdk_version: "1.32.0"
app_file: app.py
pinned: false
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

---

# πŸ“š RagBot: Chatbot + Document QA

This app lets you chat with any uploaded PDF and ask questions β€” either from the document or general ones β€” powered by **local open-source models**. Combines RAG with chatbot UX.

## πŸš€ Features

- Upload PDFs and chat with them
- General knowledge + document-specific answers
- Accurate retrieval using FAISS and sentence-transformers
- Clean, sticky UI with full chat history
- Runs 100% free using lightweight Hugging Face models

## 🧠 Powered By

- 🧠 Embeddings: `sentence-transformers/paraphrase-MiniLM-L6-v2`
- πŸ“– QA Model: `distilbert-base-cased-distilled-squad`
- 🧰 Backend: Streamlit + FAISS + Transformers

## πŸ’‘ How It Works

1. Upload your PDF
2. App chunks & embeds the text
3. Uses FAISS to retrieve context
4. Hugging Face model generates answers:
   - Uses the doc context if available
   - Falls back to general QA
   - Refuses to answer if uncertain

## πŸ“¦ Dependencies

```bash
pip install streamlit faiss-cpu sentence-transformers transformers PyMuPDF