Spaces:
Sleeping
Sleeping
Jatin Mehra
commited on
Commit
·
68f0395
1
Parent(s):
ab5e975
Update README (HF) with system architecture diagram and enhance section titles for clarity
Browse files- README_hf.md +135 -3
README_hf.md
CHANGED
|
@@ -16,7 +16,7 @@ An advanced PDF document analysis tool that combines RAG (Retrieval Augmented Ge
|
|
| 16 |
|
| 17 |
- [Overview](#overview)
|
| 18 |
- [Features](#features)
|
| 19 |
-
- [RAG
|
| 20 |
- [Architecture](#architecture)
|
| 21 |
- [Technical Stack](#technical-stack)
|
| 22 |
- [Installation](#installation)
|
|
@@ -45,6 +45,7 @@ The application employs an agentic approach that can augment the document's info
|
|
| 45 |
- **Hugging Face Integration**: Automatic deployment to Hugging Face Spaces
|
| 46 |
- **Android Application**: Native mobile client
|
| 47 |
|
|
|
|
| 48 |
## RAG System Metrics
|
| 49 |
|
| 50 |
1. **Key Metrics Overview**:
|
|
@@ -81,6 +82,138 @@ The application employs an agentic approach that can augment the document's info
|
|
| 81 |
|
| 82 |
The application follows a modular architecture with these main components:
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
### Backend Components
|
| 85 |
|
| 86 |
1. **PDF Processing Module** (`preprocessing.py`):
|
|
@@ -226,7 +359,6 @@ PDF-Insight-Beta/
|
|
| 226 |
- **Java source code**: Activity management, splash screen, and WebView configuration
|
| 227 |
- **Android resources**: UI layouts, icons, and mobile-specific configurations
|
| 228 |
|
| 229 |
-
|
| 230 |
## Technical Stack
|
| 231 |
|
| 232 |
### Backend
|
|
@@ -264,7 +396,7 @@ PDF-Insight-Beta/
|
|
| 264 |
|
| 265 |
1. Clone the repository:
|
| 266 |
```bash
|
| 267 |
-
git clone https://github.com/
|
| 268 |
cd PDF-Insight-Beta
|
| 269 |
```
|
| 270 |
|
|
|
|
| 16 |
|
| 17 |
- [Overview](#overview)
|
| 18 |
- [Features](#features)
|
| 19 |
+
- [RAG SYSTEM PERFORMANCE](#rag-system-metrics)
|
| 20 |
- [Architecture](#architecture)
|
| 21 |
- [Technical Stack](#technical-stack)
|
| 22 |
- [Installation](#installation)
|
|
|
|
| 45 |
- **Hugging Face Integration**: Automatic deployment to Hugging Face Spaces
|
| 46 |
- **Android Application**: Native mobile client
|
| 47 |
|
| 48 |
+
|
| 49 |
## RAG System Metrics
|
| 50 |
|
| 51 |
1. **Key Metrics Overview**:
|
|
|
|
| 82 |
|
| 83 |
The application follows a modular architecture with these main components:
|
| 84 |
|
| 85 |
+
### System Architecture Diagram
|
| 86 |
+
|
| 87 |
+
```mermaid
|
| 88 |
+
---
|
| 89 |
+
config:
|
| 90 |
+
theme: forest
|
| 91 |
+
look: neo
|
| 92 |
+
layout: dagre
|
| 93 |
+
---
|
| 94 |
+
flowchart TD
|
| 95 |
+
subgraph subGraph0["Presentation Layer"]
|
| 96 |
+
direction TB
|
| 97 |
+
Browser["Web Browser UI"]
|
| 98 |
+
Android["Android WebView Client"]
|
| 99 |
+
end
|
| 100 |
+
subgraph subGraph1["API Layer"]
|
| 101 |
+
direction TB
|
| 102 |
+
APIGateway["FastAPI Entrypoints"]
|
| 103 |
+
ChatRoutes["chat_routes.py"]
|
| 104 |
+
SessionRoutes["session_routes.py"]
|
| 105 |
+
UploadRoutes["upload_routes.py"]
|
| 106 |
+
UtilityRoutes["utility_routes.py"]
|
| 107 |
+
AppMain["app.py"]
|
| 108 |
+
end
|
| 109 |
+
subgraph subGraph2["Config & Models"]
|
| 110 |
+
direction TB
|
| 111 |
+
ConfigLoader["config.py"]
|
| 112 |
+
DataModels["models.py"]
|
| 113 |
+
end
|
| 114 |
+
subgraph subGraph3["Service Layer"]
|
| 115 |
+
direction TB
|
| 116 |
+
RAGService["rag_service.py"]
|
| 117 |
+
LLMService["llm_service.py"]
|
| 118 |
+
SessionService["session_service.py"]
|
| 119 |
+
end
|
| 120 |
+
subgraph subGraph4["Utility Layer"]
|
| 121 |
+
direction TB
|
| 122 |
+
TextProc["text_processing.py"]
|
| 123 |
+
FaissUtil["faiss_utils.py"]
|
| 124 |
+
SessionUtil["session_utils.py"]
|
| 125 |
+
end
|
| 126 |
+
subgraph Storage["Storage"]
|
| 127 |
+
direction TB
|
| 128 |
+
UploadStore["/uploads (PDFs & sessions)"]
|
| 129 |
+
FAISSIndex["FAISS Index (ephemeral/disk)"]
|
| 130 |
+
end
|
| 131 |
+
subgraph subGraph6["Docker Container"]
|
| 132 |
+
direction TB
|
| 133 |
+
subGraph1
|
| 134 |
+
subGraph2
|
| 135 |
+
subGraph3
|
| 136 |
+
subGraph4
|
| 137 |
+
Storage
|
| 138 |
+
end
|
| 139 |
+
subgraph subGraph7["External & DevOps"]
|
| 140 |
+
direction TB
|
| 141 |
+
GroqAPI["Groq LLM API"]
|
| 142 |
+
TavilyAPI["Tavily Web Search API"]
|
| 143 |
+
CI["GitHub Actions CI/CD"]
|
| 144 |
+
HFS["HuggingFace Spaces"]
|
| 145 |
+
DockerfileNode["Dockerfile"]
|
| 146 |
+
end
|
| 147 |
+
subgraph subGraph8["Static Assets"]
|
| 148 |
+
direction TB
|
| 149 |
+
StaticApp["Static Web App"]
|
| 150 |
+
end
|
| 151 |
+
Browser -- HTTP JSON --> StaticApp
|
| 152 |
+
StaticApp -- HTTP JSON --> AppMain
|
| 153 |
+
Android -- HTTP JSON --> AppMain
|
| 154 |
+
AppMain -- routes --> ChatRoutes & SessionRoutes & UploadRoutes & UtilityRoutes
|
| 155 |
+
ChatRoutes -- calls --> RAGService
|
| 156 |
+
SessionRoutes -- calls --> SessionService
|
| 157 |
+
UploadRoutes -- calls --> TextProc
|
| 158 |
+
UtilityRoutes -- calls --> SessionUtil
|
| 159 |
+
RAGService -- uses --> LLMService & FaissUtil
|
| 160 |
+
RAGService -- calls --> GroqAPI & TavilyAPI
|
| 161 |
+
LLMService -- uses --> ConfigLoader
|
| 162 |
+
SessionService -- uses --> SessionUtil
|
| 163 |
+
TextProc -- writes/reads --> UploadStore
|
| 164 |
+
SessionUtil -- writes/reads --> UploadStore
|
| 165 |
+
FaissUtil -- reads/writes --> FAISSIndex
|
| 166 |
+
CI -- build & deploy --> DockerfileNode
|
| 167 |
+
DockerfileNode -- deploy --> HFS
|
| 168 |
+
Browser:::frontend
|
| 169 |
+
Android:::frontend
|
| 170 |
+
APIGateway:::api
|
| 171 |
+
ChatRoutes:::api
|
| 172 |
+
SessionRoutes:::api
|
| 173 |
+
UploadRoutes:::api
|
| 174 |
+
UtilityRoutes:::api
|
| 175 |
+
AppMain:::api
|
| 176 |
+
ConfigLoader:::service
|
| 177 |
+
DataModels:::service
|
| 178 |
+
RAGService:::service
|
| 179 |
+
LLMService:::service
|
| 180 |
+
SessionService:::service
|
| 181 |
+
TextProc:::util
|
| 182 |
+
FaissUtil:::util
|
| 183 |
+
SessionUtil:::util
|
| 184 |
+
UploadStore:::util
|
| 185 |
+
FAISSIndex:::util
|
| 186 |
+
GroqAPI:::external
|
| 187 |
+
TavilyAPI:::external
|
| 188 |
+
CI:::devops
|
| 189 |
+
HFS:::devops
|
| 190 |
+
DockerfileNode:::devops
|
| 191 |
+
StaticApp:::frontend
|
| 192 |
+
classDef frontend fill:#CCE5FF,stroke:#333,stroke-width:1px
|
| 193 |
+
classDef api fill:#DFFFD6,stroke:#333,stroke-width:1px
|
| 194 |
+
classDef service fill:#FFE5B4,stroke:#333,stroke-width:1px
|
| 195 |
+
classDef util fill:#E3E4FA,stroke:#333,stroke-width:1px
|
| 196 |
+
classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px
|
| 197 |
+
classDef devops fill:#CCFFFF,stroke:#333,stroke-width:1px
|
| 198 |
+
click Android "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/Android%20App/app/src/main/res/layout/activity_splash.xml"
|
| 199 |
+
click ChatRoutes "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/api/chat_routes.py"
|
| 200 |
+
click SessionRoutes "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/api/session_routes.py"
|
| 201 |
+
click UploadRoutes "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/api/upload_routes.py"
|
| 202 |
+
click UtilityRoutes "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/api/utility_routes.py"
|
| 203 |
+
click AppMain "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/app.py"
|
| 204 |
+
click ConfigLoader "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/configs/config.py"
|
| 205 |
+
click DataModels "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/models/models.py"
|
| 206 |
+
click RAGService "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/services/rag_service.py"
|
| 207 |
+
click LLMService "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/services/llm_service.py"
|
| 208 |
+
click SessionService "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/services/session_service.py"
|
| 209 |
+
click TextProc "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/utils/text_processing.py"
|
| 210 |
+
click FaissUtil "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/utils/faiss_utils.py"
|
| 211 |
+
click SessionUtil "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/utils/session_utils.py"
|
| 212 |
+
click CI "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/.github/workflows/sync_to_hf.yml"
|
| 213 |
+
click DockerfileNode "https://github.com/jatin-mehra119/pdf-insight-beta/tree/main/Dockerfile"
|
| 214 |
+
click StaticApp "https://github.com/jatin-mehra119/pdf-insight-beta/blob/main/static/js/app.js"
|
| 215 |
+
```
|
| 216 |
+
|
| 217 |
### Backend Components
|
| 218 |
|
| 219 |
1. **PDF Processing Module** (`preprocessing.py`):
|
|
|
|
| 359 |
- **Java source code**: Activity management, splash screen, and WebView configuration
|
| 360 |
- **Android resources**: UI layouts, icons, and mobile-specific configurations
|
| 361 |
|
|
|
|
| 362 |
## Technical Stack
|
| 363 |
|
| 364 |
### Backend
|
|
|
|
| 396 |
|
| 397 |
1. Clone the repository:
|
| 398 |
```bash
|
| 399 |
+
git clone https://github.com/Jatin-Mehra119/PDF-Insight-Beta.git
|
| 400 |
cd PDF-Insight-Beta
|
| 401 |
```
|
| 402 |
|