A comprehensive Key Information Extraction (KIE) system that processes PDF, DOC, TXT, CSV files and URLs to extract structured information using advanced AI models including NanoNets OCR-s.
cd /home/bibin.wilson@beo.in/Documents/Projects/BEO/Invoice/unified-kie-system
# Replace with your server's IP address
./deployment/deploy.sh server 1 YOUR_SERVER_IP ubuntu
This will:
# Deploy locally with GPU support
./deployment/deploy.sh local 1
# Or deploy locally CPU-only (for testing)
./deployment/deploy.sh local 0
# With GPU support
docker-compose up --build -d
# CPU-only mode
export FORCE_CPU=true
docker-compose -f docker-compose.cpu.yml up --build -d
Create a .env file or set environment variables:
# Server configuration
HOST=0.0.0.0
PORT=8000
WORKERS=1
# Model configuration
NANONETS_MODEL=nanonets/Nanonets-OCR-s
LAYOUTLM_MODEL=microsoft/layoutlmv3-base
EASYOCR_LANGUAGES=en,de
# Processing limits
MAX_FILE_SIZE=52428800 # 50MB
MAX_PAGES=20
PROCESSING_TIMEOUT=300 # 5 minutes
# GPU configuration
FORCE_CPU=false
GPU_MEMORY_FRACTION=0.8
# Security
ALLOWED_EXTENSIONS=.pdf,.png,.jpg,.jpeg,.docx,.txt,.csv
MAX_URL_SIZE=10485760 # 10MB
For 20GB vRAM server:
GPU_MEMORY_FRACTION=0.9
MAX_PAGES=50
MAX_FILE_SIZE=104857600 # 100MB
For 12GB vRAM system:
GPU_MEMORY_FRACTION=0.6
MAX_PAGES=10
# Consider CPU-only mode: FORCE_CPU=true
curl -X POST "http://your-server:8000/extract/file" \
-F "file=@document.pdf" \
-F "extraction_type=auto" \
-F "language=auto" \
-F "use_schema=true"
curl -X POST "http://your-server:8000/extract/url" \
-F "url=https://example.com/document.pdf" \
-F "extraction_type=invoice" \
-F "language=en"
{
"job_id": "uuid-here",
"timestamp": "2024-01-15T10:30:00Z",
"extraction_type": "auto",
"structured_data": {
"schema_applied": "invoice",
"structured_fields": {
"invoice_number": "INV-2024-001",
"vendor_name": "Example Corp",
"total_amount": 1234.56,
"currency": "EUR"
},
"validation": {
"is_valid": true,
"completeness_score": 0.85
}
},
"processing_info": {
"strategy_used": "nanonets",
"pages_processed": 2
}
}
Access the web interface at http://your-server:8000
Features:
GET / - Web interfacePOST /extract/file - Process uploaded filePOST /extract/url - Process URL contentGET /results/{job_id} - Retrieve resultsGET /health - Health checkGET /stats - System statisticsGET /schemas - Available schemasGET /docs - API documentation# Reduce memory usage
export GPU_MEMORY_FRACTION=0.5
# Or use CPU-only mode
export FORCE_CPU=true
# Check logs
docker-compose logs unified-kie-system
# Restart with clean cache
docker-compose down -v
docker-compose up --build
# Fix directory permissions
sudo chown -R $(whoami):$(whoami) uploads results models logs
For maximum performance on 20GB vRAM:
For limited resources:
curl http://your-server:8000/health
curl http://your-server:8000/stats
# View logs
docker-compose logs -f
# Check resource usage
docker stats
# GPU monitoring (if available)
nvidia-smi
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Web Interface │────│ FastAPI Server │────│ AI Processors │
│ (Port 8000) │ │ (Unified KIE) │ │ (GPU/CPU) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
┌────────┴────────┐
│ │
┌──────▼─────┐ ┌──────▼─────┐
│ File │ │ Schema │
│ Storage │ │ Manager │
└────────────┘ └────────────┘
This project integrates multiple open-source components. Please review individual component licenses for compliance.
For issues and questions:
# Pull latest changes
git pull origin main
# Rebuild and restart
docker-compose down
docker-compose up --build -d
# Clear model cache if needed
docker-compose down -v
rm -rf models/*
docker-compose up --build -d
Built with ❤️ for efficient document processing
3 commits
Python
81.7%
HTML
10.9%
Shell
6.9%
A comprehensive Key Information Extraction (KIE) system that processes PDF, DOC, TXT, CSV files and URLs to extract structured information using advanced AI models including NanoNets OCR-s.
cd /home/bibin.wilson@beo.in/Documents/Projects/BEO/Invoice/unified-kie-system
# Replace with your server's IP address
./deployment/deploy.sh server 1 YOUR_SERVER_IP ubuntu
This will:
# Deploy locally with GPU support
./deployment/deploy.sh local 1
# Or deploy locally CPU-only (for testing)
./deployment/deploy.sh local 0
# With GPU support
docker-compose up --build -d
# CPU-only mode
export FORCE_CPU=true
docker-compose -f docker-compose.cpu.yml up --build -d
Create a .env file or set environment variables:
# Server configuration
HOST=0.0.0.0
PORT=8000
WORKERS=1
# Model configuration
NANONETS_MODEL=nanonets/Nanonets-OCR-s
LAYOUTLM_MODEL=microsoft/layoutlmv3-base
EASYOCR_LANGUAGES=en,de
# Processing limits
MAX_FILE_SIZE=52428800 # 50MB
MAX_PAGES=20
PROCESSING_TIMEOUT=300 # 5 minutes
# GPU configuration
FORCE_CPU=false
GPU_MEMORY_FRACTION=0.8
# Security
ALLOWED_EXTENSIONS=.pdf,.png,.jpg,.jpeg,.docx,.txt,.csv
MAX_URL_SIZE=10485760 # 10MB
For 20GB vRAM server:
GPU_MEMORY_FRACTION=0.9
MAX_PAGES=50
MAX_FILE_SIZE=104857600 # 100MB
For 12GB vRAM system:
GPU_MEMORY_FRACTION=0.6
MAX_PAGES=10
# Consider CPU-only mode: FORCE_CPU=true
curl -X POST "http://your-server:8000/extract/file" \
-F "file=@document.pdf" \
-F "extraction_type=auto" \
-F "language=auto" \
-F "use_schema=true"
curl -X POST "http://your-server:8000/extract/url" \
-F "url=https://example.com/document.pdf" \
-F "extraction_type=invoice" \
-F "language=en"
{
"job_id": "uuid-here",
"timestamp": "2024-01-15T10:30:00Z",
"extraction_type": "auto",
"structured_data": {
"schema_applied": "invoice",
"structured_fields": {
"invoice_number": "INV-2024-001",
"vendor_name": "Example Corp",
"total_amount": 1234.56,
"currency": "EUR"
},
"validation": {
"is_valid": true,
"completeness_score": 0.85
}
},
"processing_info": {
"strategy_used": "nanonets",
"pages_processed": 2
}
}
Access the web interface at http://your-server:8000
Features:
GET / - Web interfacePOST /extract/file - Process uploaded filePOST /extract/url - Process URL contentGET /results/{job_id} - Retrieve resultsGET /health - Health checkGET /stats - System statisticsGET /schemas - Available schemasGET /docs - API documentation# Reduce memory usage
export GPU_MEMORY_FRACTION=0.5
# Or use CPU-only mode
export FORCE_CPU=true
# Check logs
docker-compose logs unified-kie-system
# Restart with clean cache
docker-compose down -v
docker-compose up --build
# Fix directory permissions
sudo chown -R $(whoami):$(whoami) uploads results models logs
For maximum performance on 20GB vRAM:
For limited resources:
curl http://your-server:8000/health
curl http://your-server:8000/stats
# View logs
docker-compose logs -f
# Check resource usage
docker stats
# GPU monitoring (if available)
nvidia-smi
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Web Interface │────│ FastAPI Server │────│ AI Processors │
│ (Port 8000) │ │ (Unified KIE) │ │ (GPU/CPU) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
┌────────┴────────┐
│ │
┌──────▼─────┐ ┌──────▼─────┐
│ File │ │ Schema │
│ Storage │ │ Manager │
└────────────┘ └────────────┘
This project integrates multiple open-source components. Please review individual component licenses for compliance.
For issues and questions:
# Pull latest changes
git pull origin main
# Rebuild and restart
docker-compose down
docker-compose up --build -d
# Clear model cache if needed
docker-compose down -v
rm -rf models/*
docker-compose up --build -d
Built with ❤️ for efficient document processing
3 commits
Python
81.7%
HTML
10.9%
Shell
6.9%