Spaces:
Runtime error
Runtime error
π Quick Start - Run in 3 Steps
Step 1: Install Requirements
pip install -r requirements.txt
For Windows users (OCR support):
- Download Tesseract from: https://github.com/UB-Mannheim/tesseract/wiki
- Run the installer
- Add to PATH or set in code
Step 2: Start the Server
python main.py
You should see:
INFO: Uvicorn running on http://0.0.0.0:8000
Step 3: Open Dashboard
Visit in your browser:
http://localhost:8000/dashboard
π― What You Can Do
Upload Documents
- Click "π€ Upload Document"
- Select an image or text file
- Results appear automatically
Extract Data
- Click "βοΈ Extract from Text"
- Paste your document text
- Click "Extract Data"
View Results
- See extracted fields with confidence scores
- Check data quality metrics
- View document classification
Monitor Jobs
- Track processing status
- View system statistics
- Check success rates
π API Quick Reference
Extract from Text
curl -X POST "http://localhost:8000/extract" \
-H "Content-Type: application/json" \
-d '{"text": "Invoice #123 for $500"}'
Upload File
curl -X POST "http://localhost:8000/upload" \
-F "file=@document.pdf"
Batch Process
curl -X POST "http://localhost:8000/batch" \
-H "Content-Type: application/json" \
-d '{"documents": [{"text": "Doc 1"}, {"text": "Doc 2"}]}'
Get Job Status
curl http://localhost:8000/jobs/{job_id}
π Python Usage
import asyncio
from app.pipeline import DocumentProcessingPipeline
async def main():
pipeline = DocumentProcessingPipeline()
result = await pipeline.process_document(
document_id="doc_001",
text="Invoice #123 Amount: $500.00"
)
print(f"Type: {result.classification.document_type}")
print(f"Confidence: {result.classification.confidence:.2%}")
print(f"Fields: {len(result.extraction.extracted_fields)}")
print(f"Quality: {result.validation.data_quality_score:.2%}")
asyncio.run(main())
π§ͺ Run Examples
python examples.py
This will show you:
- Single document processing
- Batch processing
- Custom field extraction
- Data validation
π³ Docker Alternative
# Build image
docker build -t doc-intelligence .
# Run container
docker run -p 8000:8000 -v ./uploads:/app/uploads doc-intelligence
# Visit http://localhost:8000/dashboard
βοΈ Configuration
Create .env file if needed:
API_PORT=8000
DATABASE_URL=sqlite:///./documents.db
OCR_LANG=eng
LOG_LEVEL=INFO
β Verify Installation
# Check health
curl http://localhost:8000/health
# Should return: {"status":"healthy",...}
π Full Documentation
See QUICKSTART.md for detailed guide or app/README.md for complete documentation.
π You're all set! Open http://localhost:8000/dashboard to get started!