Spaces:
Sleeping
A newer version of the Streamlit SDK is available: 1.59.0
Running the DocSentry Demo App
Quick start (3 commands)
# From: C:\Users\HP\Desktop\Anomaly Based project\
pip install -r requirements.txt
streamlit run app.py
That's it. Streamlit will open the app at http://localhost:8501 in your browser.
Optional: install Tesseract OCR (for full text-rule checks)
- Download from https://github.com/UB-Mannheim/tesseract/wiki
- Run the
.exeinstaller - Check "Add Tesseract to system PATH" during install
- Restart your terminal, then
streamlit run app.pyagain
The app works without Tesseract too β only the text/OCR-based checks are skipped.
What's in the app
Tab 1 β Single-document analysis (your primary demo)
- Drag-drop a PNG / JPG / PDF
- See risk band (LOW / MEDIUM / HIGH / CRITICAL) in big colored text
- Sub-score breakdown bar chart
- ELA heatmap, copy-move match visualization, noise inconsistency heatmap (image files)
- Producer / creator / fonts table (PDFs)
- Trained ML model verdict (if
models/forgery_rf.joblibexists) - Download audit JSON or formatted PDF report
Tab 2 β Cross-document consistency check (the novel angle)
- Upload 2β4 documents for the same applicant
- App extracts name, DOB, address, account, IFSC from each
- Field-by-field comparison table with green/yellow/red status
- Mismatch detector with similarity scores
- Download consistency report JSON
Tab 3 β Batch audit
- Point at a folder, scan every file in it
- Get risk band per file as a sortable table
- Download CSV for the underwriting team
Demo flow (for the pitch)
- Open Tab 1, drop in a clean
land_000.pngfromdata/images/originals/β "LOW" green band, no evidence - Drop in a
land_005_copy_move.pngfromdata/images/tampered/β "HIGH" orange band, copy-move evidence - Click through the heatmap tabs β judges see real visualizations, not just numbers
- Click "Download audit PDF" β a bank-letterhead report renders
- Switch to Tab 2, upload 2 different
agreement_*.pngfiles β "HIGH" mismatch because names differ - Switch to Tab 3, point at
data/β batch-process 250+ files in a few seconds
Total demo time: 3 minutes. Hands the judges something to download.
Project file layout
C:\Users\HP\Desktop\Anomaly Based project\
βββ app.py <-- Streamlit UI (this app)
βββ forensics.py <-- Core detection module
βββ audit_report.py <-- PDF report generator
βββ requirements.txt <-- pip dependencies
βββ RUN_APP.md <-- this file
βββ DATASETS.md <-- where to get more training data
βββ COLAB_QUICKSTART.md <-- Colab usage guide
βββ anomaly_detection_banking.ipynb <-- local Jupyter notebook
βββ anomaly_detection_banking_COLAB.ipynb <-- Colab notebook
βββ data/
β βββ images/originals/ 130 genuine docs
β βββ images/tampered/ 130 tampered docs
β βββ pdfs/originals/ 30 PDFs
β βββ pdfs/tampered/ 30 tampered PDFs
β βββ statements/ 60 statements
βββ models/
βββ forgery_rf.joblib (created after running Section 7.5 in the notebook)
Common issues
"ModuleNotFoundError: No module named 'forensics'"
You're not in the project folder. cd "C:\Users\HP\Desktop\Anomaly Based project" first, then streamlit run app.py.
"streamlit: command not found"
Streamlit didn't install. Re-run pip install -r requirements.txt. On Windows, you may need python -m streamlit run app.py instead.
The "Download audit PDF" button shows a warning
Make sure reportlab installed cleanly. Re-run pip install reportlab.
Cross-doc tab says "ocr_skipped" for every field You don't have Tesseract installed. The forensic checks still work; only the cross-doc field extraction needs OCR. Install Tesseract (see above) to unlock that tab.
The trained ML model section doesn't appear
You haven't run Section 7.5 in the notebook yet. Open anomaly_detection_banking.ipynb, run all cells through Section 7.5; that creates models/forgery_rf.joblib. The Streamlit app picks it up automatically.
Architecture sketch
ββββββββββββββββββββββββββββββββββββββββββββββββ
β app.py (Streamlit) β
β Tab1: Single doc Tab2: Cross-doc β
β Tab3: Batch audit Downloads: JSON + PDF β
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββ
β imports
ββββββββββββ΄βββββββββββ
βΌ βΌ
forensics.py audit_report.py
- ELA / copy-move - ReportLab PDF
- noise / EXIF - Heatmap embeds
- PDF audit - Bank letterhead
- OCR + text rules - Evidence list
- RF model load
- Cross-doc check
All three files run on plain Python 3.10+, CPU-only, no paid APIs.