File size: 1,812 Bytes
2a9e166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: OCR Notification & Data Extractor
emoji: 🧾
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: mit
---

# OCR Notification & Data Extractor

Upload scanned PDFs or images and turn them into structured, exportable
data. Built for teams that need to pull actionable "notification" events
and key fields out of paper-heavy workflows:

- **Construction / SAP data support** β€” change orders, delay notices,
  punch list items, RFIs, PO numbers, SAP document numbers, quantities.
- **Compliance** β€” non-conformances, violations, expirations, corrective
  actions, certification codes (ISO, OSHA, ASTM, ANSI).
- **Business finance** β€” past-due invoices, payment rejections, credit
  holds, invoice numbers, dollar amounts, due dates.

## How it works

1. Upload one or more PDFs or images.
2. Each page's text is pulled directly from the PDF when it has a text
   layer; scanned/image-only pages are rendered and run through
   Tesseract OCR.
3. The text is scanned against keyword sets for the categories you pick
   (or your own custom keywords), and structured fields (PO/SAP/invoice
   numbers, dates, dollar amounts, percentages, certification codes) are
   pulled out with regex.
4. Results are shown in a table and exported as a CSV, one row per page
   that has a hit (or every page, if you turn that filter off).

## Local development

```bash
pip install -r requirements.txt
# Tesseract must also be installed on the system, e.g.:
#   apt-get install tesseract-ocr
python app.py
```

## Files

- `app.py` β€” Gradio UI and orchestration.
- `ocr_engine.py` β€” PDF/image loading and OCR (PyMuPDF + Tesseract).
- `extractors.py` β€” keyword notification scanning and structured field
  extraction (regex-based, easy to extend per domain).