A Flask-based web application that digitizes and interprets historical handwritten documents using the Gemini AI API
- Accepts PDFs, JPGs, and PNGs of historical documents
- Handles multi-page PDFs by converting each page to images
- Secure file storage with original preservation
- Handwriting Recognition: Extracts text from even poor-quality scans
- Text Cleaning: Fixes spacing and obvious errors while preserving original meaning
- Smart Entity Extraction: Identifies and tags:
- People (
[PERSON]
) - Locations (
[LOCATION]
) - Dates (
[DATE]
) - Document types (
[DOC_TYPE]
)
- People (
- Automatic Summarization: Creates easy-to-understand summaries
- Historical Term Glossary: Explains archaic legal/administrative terms
- Ask natural language questions like:
- "Who is mentioned in this document?"
- "What is the main purpose of this deed?"
- "Translate this section to Hindi"
- Get context-aware answers based on the document content
- Side-by-Side View: Compare original document with processed text
- Color-Coded Highlights: Easily spot important entities
- Download Options: Save processed text or summary as TXT/PDF
- View all previously processed documents
- Quick access to past results
- Never lose your work
- Quickly digitize archival materials
- Search across collections for names/places
- Understand obsolete legal terminology
- Analyze old property deeds and land records
- Trace historical ownership chains
- Extract key clauses from vintage contracts
- Read old family documents and letters
- Identify ancestors in historical records
- Understand context of old certificates
- Create searchable digital archives
- Preserve fragile documents through digitization
- Make collections more accessible
- Flask (Python web framework)
- SQLite (Lightweight database)
- Gemini API (For all AI processing)
- PyMuPDF (PDF processing)
- Pillow (Image handling)
- HTML5/CSS3 with responsive design
- JavaScript for interactive features
- Bootstrap 5 for clean UI components
- Python 3.8+
- Gemini API key (free tier available)
- Basic terminal skills
-
Clone the repository:
git clone https://github.com/yourusername/historical-docs-interpreter.git cd historical-docs-interpreter
-
Install dependencies:
pip install -r requirements.txt
-
Configure your Gemini API key:
- Create a
config.py
file - Add:
GEMINI_API_KEY = "your-api-key-here"
- Create a
-
Run the application:
python app.py
-
Access in your browser at:
http://localhost:5000
-
Upload Documents
- Click "Choose File" or drag-and-drop
- Supported formats: PDF, JPG, PNG
- Maximum size: 16MB
-
View Results
- Left panel shows original document
- Right panel shows processed text with:
- Summary at the top
- Full text below
- Color-highlighted entities
-
Ask Questions
- Type questions in the chat box
- Examples:
- "List all people mentioned"
- "What year was this written?"
- "Explain the legal terms used"
-
Access History
- View all processed documents
- Click any entry to reload results
The system can handle documents in:
- English (including archaic forms)
- Hindi (and other Indian languages)
- Mixed-language documents
Translation features:
- Modernize old language forms
- Explain regional terms
- Cross-language queries ("Translate this to Hindi")
-
Handwriting Quality
- Works best with clear handwriting
- May struggle with very cursive scripts
-
Document Age
- Best for 18th-20th century documents
- Older materials may need manual verification
-
Language Coverage
- Strongest support for English and Hindi
- Other languages may have reduced accuracy
MIT License - Free for personal and academic use
- Built using Google's Gemini AI
- Inspired by archival digitization projects worldwide
- Community contributors welcome!