File size: 4,669 Bytes
b1d31ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ⚡ AI PDF Review Assistant

```

   ___  _     ____  ____  _____     __   __  

  / _ \| |   |  _ \|  _ \| ____|   / /   \ \ 

 | | | | |   | |_) | |_) |  _|    / /     \ \

 | |_| | |___| __/|  _ <| |___   / /       \ \

  \__\_\_____|_|   |_| \_\_____|/_/  REVIEW  \_\

```

> *"Knowledge locked in pages... until now."*

---

## 🌸 What is this?

**AI PDF Review Assistant** is an intelligent document analysis system powered by Google Gemini and a custom RAG (Retrieval-Augmented Generation) pipeline. Feed it your PDFs — it reads them, understands them, and answers your questions like a brilliant study partner who never sleeps.

Ask in **Bengali or English**. Get answers with **full LaTeX math rendering**. It remembers the conversation. It finds exactly what you need.

---

## ⚔️ The Pipeline — How It Works

```

  [ Your PDF ]



  ┌─────────────────────────────┐

  │  PyMuPDF converts each      │

  │  page → image               │

  └────────────┬────────────────┘



  ┌─────────────────────────────┐

  │  Gemini Vision reads every  │

  │  image — Bengali, math,     │

  │  diagrams, handwriting      │

  └────────────┬────────────────┘



  ┌─────────────────────────────┐

  │  Gemini Embedding converts  │

  │  text → vectors (3072D)     │

  └────────────┬────────────────┘



  ┌─────────────────────────────┐

  │  ChromaDB stores vectors    │

  │  on disk permanently        │

  └────────────┬────────────────┘


       [ You ask a question ]



  ┌─────────────────────────────┐

  │  Your question → embedded   │

  │  → ChromaDB finds closest   │

  │  matching pages             │

  └────────────┬────────────────┘



  ┌─────────────────────────────┐

  │  Gemini answers using only  │

  │  YOUR notes as context      │

  └─────────────────────────────┘

```

---

## 🚀 How to Use

**1.** Create a `.env` file in the project root:
```

GEMINI_API_KEY=your_api_key_here

```

**2.** Get your free Gemini API key from: https://aistudio.google.com/apikey

**3.** Create and activate a virtual environment:
```bash

# Windows

python -m venv venv

venv\Scripts\activate



# Mac/Linux

python -m venv venv

source venv/bin/activate

```

**4.** Install all dependencies:
```bash

pip install -r requirements.txt

```

**5.** Launch the app:
```bash

streamlit run app.py

```

**6.** Use the **Extractor** first from the sidebar to process your PDFs before asking questions.

**7.** Done — start asking! ⚡

---

## 📁 Project Structure

```

ai-pdf-review-assistant/


├── app.py               # Streamlit UI

├── extract.py           # Image → text extraction via Gemini

├── embed.py             # Text → vector embeddings

├── store.py             # Store vectors in ChromaDB

├── query.py             # Question answering pipeline


├── data/

│   └── vector_db/       # ChromaDB persistent storage


├── extracted_texts.json

├── embeddings.json

├── .env                 # Your API key goes here

├── requirements.txt

└── README.md

```

---

## 🗡️ Tech Stack

```

Language      →  Python

UI            →  Streamlit

Vector DB     →  ChromaDB

PDF Parser    →  PyMuPDF (fitz)

AI Model      →  Google Gemini (vision + embedding + generation)

```

---

## 📜 License

```

Copyright 2026 Renerfia



Licensed under the Apache License, Version 2.0

```

---

<div align="center">

*Built with obsession. Powered by Gemini. Forged in Python.*

⭐ Star this repo if it helped you

</div>