How nanonets/docaiagent works
Project Type and Purpose
• This is a Python-based, modular Document AI Agent featuring a Gradio web UI for end-users, a core “agent” orchestration layer, and several specialized processing modules. Its goal is to ingest scanned or photographed documents, perform OCR, classify document types, extract structured fields via LLMs, review the results, and present/download final JSON data.
File Structure
• Top-level scripts:
• gradio_app.py – the front-end server and orchestrator for user interactions
• document_ai_agent.py – an autonomous agent built atop the qwen-agent framework that drives extraction and review tools
• ocr_module.py, classifier.py, extractor.py, reviewer.py – four core processing stages
• llm_module.py – unified interface to call external LLM endpoints
• config.py & .env.example – LLM endpoint, API key configurations
• utils/ – shared helper functions for each module
• Support files: requirements.txt, Jupyter walkthrough notebook, environment template
Extract Insights from README
• Workflow stages: Upload → OCR → Classification → Field Confirmation → Extraction → (Optional) Review → Display & Download
• Multiple OCR backends (Tesseract, Google Vision, Surya)
• Multiple LLM backends (Qwen2.5, Qwen2.5-VL, Qwen3-8B, etc.), configurable in config.py and .env
• Agentic orchestration vs. explicit function calls