Spaces:
Sleeping
Sleeping
File size: 8,248 Bytes
2b293a8 8ab75d1 f99e19b 8ab75d1 f99e19b 8ab75d1 f99e19b 2b293a8 f99e19b 8ab75d1 a42a7e2 2b293a8 a42a7e2 8ab75d1 a42a7e2 8ab75d1 a42a7e2 8ab75d1 2b293a8 8ab75d1 a42a7e2 2b293a8 a42a7e2 8ab75d1 a42a7e2 2b293a8 8ab75d1 2b293a8 8ab75d1 2b293a8 8ab75d1 2b293a8 8ab75d1 2b293a8 8ab75d1 a42a7e2 8ab75d1 2b293a8 f99e19b 8ab75d1 ec08603 2b293a8 8ab75d1 2b293a8 8ab75d1 f99e19b 8ab75d1 2b293a8 8ab75d1 2b293a8 8ab75d1 f99e19b ec08603 f99e19b ec08603 2b293a8 8ab75d1 ec08603 2b293a8 ec08603 f99e19b ec08603 f99e19b 8ab75d1 2b293a8 | 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | ---
title: DocIQ - Intelligent Document Processing
emoji: π§
colorFrom: blue
colorTo: purple
sdk: streamlit
sdk_version: "1.40.0"
python_version: "3.10"
app_file: app.py
pinned: false
---
# π§ DocIQ β Intelligent Document Processing
[](https://www.python.org/)
[](https://streamlit.io/)
[](https://github.com/JaidedAI/EasyOCR)
[](LICENSE)
[](https://huggingface.co/spaces/Goutam112/Text_Extracted)
**DocIQ** is an Intelligent Document Processing (IDP) platform that transforms document images into structured, searchable, and exportable information.
Upload a document image, select a built-in sample, or capture an image using your webcam. DocIQ performs OCR, evaluates recognition confidence, visualizes detected text, extracts entities, detects sensitive information, and exports the results in multiple formats.
---
## β¨ Features
| Feature | Description |
| -------------------------- | ----------------------------------------------------------------------------------- |
| π― **OCR Accuracy Score** | Confidence-weighted accuracy grade from A+ to D |
| πΌοΈ **Visual Canvas** | Bounding boxes, confidence heatmap, and reading-order overlay on the original image |
| π **Keyword Search** | Instantly search and highlight words on the document canvas |
| ποΈ **Entity Extraction** | Automatically detect dates, amounts, invoice numbers, emails, and phone numbers |
| π‘οΈ **PII Redaction** | Detect and mask sensitive information such as Aadhaar, PAN, and credit-card numbers |
| 𧬠**Semantic Embeddings** | Generate 2D word-cluster visualizations using sentence-transformers with PCA/t-SNE |
| π€ **Multi-Format Export** | Export searchable PDFs, annotated PDFs, JSON, CSV, plain text, and ZIP bundles |
| πΈ **Camera Scanner** | Capture documents directly through the webcam when the scanner is enabled |
---
## π Quick Start
### Run Locally
```bash
git clone https://github.com/Goutam16-Withcode/DocIQ---Intelligent-Document-Processing.git
cd DocIQ---Intelligent-Document-Processing
pip install -r requirements.txt
python -m streamlit run app.py
```
Open:
```text
http://localhost:8501
```
### π€ Live Demo
[DocIQ β Hugging Face Space](https://huggingface.co/spaces/Goutam112/Text_Extracted?utm_source=chatgpt.com)
---
## π How It Works
```text
Upload / Camera Capture
β
Display Original Image
β
Image Preprocessing
βββ EXIF orientation correction
βββ Automatic deskew
βββ CLAHE contrast enhancement
βββ Shadow removal
βββ Unsharp-mask sharpening
β
EasyOCR Neural Inference
βββ Primary OCR pass
βββ High-sensitivity fallback pass
β
Structured Document Output
βββ Bounding boxes
βββ Confidence analysis
βββ OCR quality grade
βββ Entity extraction
βββ PII detection/redaction
βββ Multi-format export
```
---
## π OCR Quality Grades
| Grade | Accuracy | Meaning |
| :----: | :------: | ----------------------------------------------- |
| **A+** | 90β100% | Exceptional recognition confidence |
| **A** | 80β89% | High recognition confidence |
| **B** | 68β79% | Good recognition with possible minor errors |
| **C** | 50β67% | Moderate recognition; manual review recommended |
| **D** | < 50% | Low recognition; better image quality may help |
> **Note:** The grade is an application-level confidence metric and should not be interpreted as a formal benchmark of OCR accuracy against ground-truth annotations.
---
## π§ Processing Pipeline
DocIQ separates the image shown to the user from the image transformations used internally for OCR.
### 1. Image Acquisition
Documents can be provided through:
* π File upload
* π§ͺ Built-in sample documents
* πΈ Webcam capture
### 2. Preprocessing
The OCR pipeline can apply several image-processing operations:
* EXIF orientation correction
* Deskewing
* CLAHE contrast enhancement
* Shadow removal for camera images
* Sharpening
These transformations are performed internally to improve OCR recognition while preserving the original document for visualization.
### 3. OCR
DocIQ uses **EasyOCR with PyTorch** to detect and recognize text.
The OCR output contains:
* Detected text
* Bounding boxes
* Confidence scores
* Reading order information
### 4. Information Extraction
The recognized text is further processed to identify structured information such as:
* Dates
* Currency amounts
* Invoice numbers
* Email addresses
* Phone numbers
### 5. PII Detection
Potentially sensitive identifiers can be detected and optionally redacted, including:
* Aadhaar numbers
* PAN numbers
* Credit-card numbers
### 6. Semantic Analysis
Recognized words can be converted into semantic embeddings and projected into a 2D visualization using dimensionality-reduction techniques such as PCA or t-SNE.
---
## π€ Export Formats
DocIQ supports multiple output formats:
| Format | Use Case |
| ------------------ | -------------------------------------------- |
| **Searchable PDF** | Searchable version of the extracted document |
| **Annotated PDF** | Document with OCR annotations |
| **JSON** | Structured OCR and entity data |
| **CSV** | Tabular extraction results |
| **TXT** | Plain-text OCR output |
| **ZIP** | Bundle of multiple generated outputs |
---
## π Project Structure
```text
DocIQ/
βββ app.py # Main Streamlit application
βββ requirements.txt # Python dependencies
βββ src/
βββ preprocessor.py # Image enhancement pipeline
βββ ocr_engine.py # EasyOCR engine and OCR metrics
βββ visualizer.py # Bounding boxes, heatmap, reading order
βββ extractor.py # Entity and invoice field extraction
βββ embedder.py # Semantic embeddings and clustering
βββ exporter.py # PDF, JSON, CSV, ZIP export
βββ sample_docs.py # Built-in sample document generator
```
---
## βοΈ Technology Stack
* **Python 3.10+**
* **Streamlit**
* **PyTorch**
* **EasyOCR**
* **OpenCV**
* **NumPy**
* **Pandas**
* **Sentence Transformers**
* **PCA / t-SNE**
* **ReportLab**
* **JSON / CSV processing**
---
## π‘οΈ Privacy
DocIQ is designed with local processing in mind.
OCR processing, image preprocessing, and embedding generation are performed within the application environment. The application does not intentionally send uploaded document images or extracted text to external APIs as part of the core processing pipeline.
When deploying the application to a hosted environment such as Hugging Face Spaces, uploaded data is processed within that hosted runtime. Users should therefore avoid uploading sensitive documents unless they understand the hosting environment and its data-retention policies.
---
## π€ Hugging Face Space
**Live Demo:**
[Open DocIQ on Hugging Face](https://huggingface.co/spaces/Goutam112/Text_Extracted?utm_source=chatgpt.com)
---
## π License
MIT License β open source and free to use.
---
## π Project Repository
[DocIQ GitHub Repository](https://github.com/Goutam16-Withcode/DocIQ---Intelligent-Document-Processing?utm_source=chatgpt.com)
---
Check out the configuration reference at [Hugging Face Spaces Configuration Reference](https://huggingface.co/docs/hub/spaces-config-reference?utm_source=chatgpt.com)
|