Text_Extracted / README.md
Goutam112's picture
Update README.md
2b293a8 verified
|
Raw History Blame Contribute Delete
8.25 kB

A newer version of the Streamlit SDK is available: 1.66.1

Upgrade
metadata
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 Streamlit EasyOCR License HF Space

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

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:

http://localhost:8501

πŸ€— Live Demo

DocIQ β€” Hugging Face Space


πŸ”„ How It Works

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

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


πŸ“„ License

MIT License β€” open source and free to use.


πŸ”— Project Repository

DocIQ GitHub Repository


Check out the configuration reference at Hugging Face Spaces Configuration Reference