File size: 4,915 Bytes
148cf8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f6fc558
148cf8e
 
f6fc558
148cf8e
 
f6fc558
 
148cf8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# πŸ§ͺ VDoc-RAG Testing Guide

A step-by-step guide to test the VDoc-RAG document Q&A application.

---

## πŸ“‹ Table of Contents

1. [Access the Application](#1-access-the-application)
2. [Upload a Document](#2-upload-a-document)
3. [Ask Questions](#3-ask-questions)
4. [Review the Response](#4-review-the-response)
5. [Provide Feedback](#5-provide-feedback)
6. [Additional Features](#6-additional-features)
7. [Troubleshooting](#7-troubleshooting)

---

## 1. Access the Application

### Online (HuggingFace Spaces)
Open the live demo: **https://huggingface.co/spaces/adi9128/vdoc_rag**

### Local Development
```bash
# Start the server
uvicorn app.main:app --host 127.0.0.1 --port 8000

# Open in browser
http://127.0.0.1:8000
```

---

## 2. Upload a Document

### Step 2.1: Select a File
- Click the **"Choose File"** button
- Select a PDF file from your computer
- Supported formats: `.pdf`, `.png`, `.jpg`, `.jpeg`

### Step 2.2: Upload & Index
- Click **"Upload & Index"** button
- Wait for processing (usually 5-15 seconds)
- You'll see: `βœ… Uploaded and indexed [filename] (X chunks)`

### Step 2.3: Confirmation
- A green box will appear: **"πŸ“Ž Ready to query: [filename]"**
- The document is now indexed and ready for questions

---

## 3. Ask Questions

### Step 3.1: Enter Your Question
- Type your question in the text box
- Example questions:
  - "What is the user's name?"
  - "What skills are mentioned?"
  - "Summarize this document"
  - "What is the contact email?"
  - "List the work experience"

### Step 3.2: Submit
- Click **"Ask Question"** button
- Wait for the AI to process (2-5 seconds)

---

## 4. Review the Response

### The Answer Section Shows:

| Component | Description |
|-----------|-------------|
| **πŸ’‘ Answer** | AI-generated response based on your document |
| **πŸ“š Sources** | Which pages/sections were used |
| **πŸ” Retrieved Chunks** | Raw text segments found in the document |
| **Confidence %** | How relevant each chunk is to your question |

### Example Response:
```
πŸ’‘ Answer:
The user's name is Aditya, as mentioned in the resume header.

πŸ“š Sources:
- Page 1 β†’ Name: Aditya, Email: aditya@example.com...

πŸ” Retrieved Chunks:
[1] Name: Aditya | Confidence: 95.2%
[2] Contact: aditya@example.com | Confidence: 87.1%
```

---

## 5. Provide Feedback

After receiving an answer, you can help improve the system:

| Button | When to Use |
|--------|-------------|
| **βœ… Correct** | The answer is accurate and helpful |
| **❌ Incorrect** | The answer is wrong or irrelevant |

Your feedback helps improve future responses!

---

## 6. Additional Features

### Clear Cache
- Click **"🧹 Clear Cache"** to remove cached responses
- Use when you want fresh answers

### Clear Persistent Index
- Click **"πŸ—‘οΈ Clear Persistent Index"** to remove all indexed documents
- Use to start completely fresh

### Dashboards

| Dashboard | URL | Purpose |
|-----------|-----|---------|
| Feedback | `/feedback_dashboard` | View feedback statistics |
| Benchmark | `/benchmark_dashboard` | Evaluate embedding models |

---

## 7. Troubleshooting

### "No document found. Please upload a document first."
- **Cause**: No document is currently indexed
- **Solution**: Upload a PDF file first

### "Internal Server Error" after uploading
- **Cause**: Server state issue
- **Solution**: Refresh the page and try uploading again

### Document shows from another user
- **Note**: This is a shared demo instance
- **Solution**: Upload your own document - it will replace the previous one

### Slow response times
- **Cause**: First load downloads ML models (~500MB)
- **Solution**: Wait for initial setup, subsequent queries are faster

### OCR not extracting text properly
- **Cause**: Low quality PDF or scanned image
- **Solution**: Use higher resolution PDFs or clear text documents

---

## πŸ“ Test Scenarios

### Scenario 1: Resume Testing
1. Upload a resume PDF
2. Ask: "What is the candidate's name?"
3. Ask: "What are their skills?"
4. Ask: "List their work experience"

### Scenario 2: Report Testing
1. Upload a business report PDF
2. Ask: "What is the main topic?"
3. Ask: "Summarize the key findings"
4. Ask: "What recommendations are made?"

### Scenario 3: Invoice Testing
1. Upload an invoice PDF
2. Ask: "What is the total amount?"
3. Ask: "What items are listed?"
4. Ask: "What is the due date?"

---

## βœ… Success Criteria

The application is working correctly if:
- [x] Document uploads successfully with chunk count
- [x] Questions return relevant answers
- [x] Confidence scores are displayed
- [x] Source attribution shows page numbers
- [x] Feedback buttons work
- [x] New uploads replace old documents

---

## πŸ†˜ Getting Help

If you encounter issues:
1. Check the browser console for errors (F12)
2. Try refreshing the page
3. Upload a different PDF to test
4. Clear the index and try again

---

**Made with ❀️ by Aditya**