--- 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 [![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)](https://www.python.org/) [![Streamlit](https://img.shields.io/badge/Streamlit-1.40%2B-FF4B4B.svg)](https://streamlit.io/) [![EasyOCR](https://img.shields.io/badge/EasyOCR-PyTorch-green.svg)](https://github.com/JaidedAI/EasyOCR) [![License](https://img.shields.io/badge/License-MIT-purple.svg)](LICENSE) [![HF Space](https://img.shields.io/badge/๐Ÿค—%20Live%20Demo-HuggingFace-orange.svg)](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)