APAgent-Demo / README_HF.md
KarthiEz's picture
Upload 56 files
8850939 verified
metadata
title: AP Agent Demo
emoji: πŸ“„
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit

AP Agent Demo - Invoice ↔ PO Matching

AI-powered Accounts Payable processing application that automatically matches invoices to purchase orders, detects backorders, validates suppliers, and identifies duplicates.

Features

  • πŸ€– AI-Powered Matching: Uses Azure OpenAI to dynamically match invoice lines to PO lines, handling any column names
  • πŸ“Š Backorder Tracking: Automatically calculates remaining quantities per PO line
  • βœ… Supplier Validation: Validates suppliers against approved supplier lists
  • πŸ” Duplicate Detection: Detects duplicate invoices by file hash and business key
  • πŸ“ˆ History & Analytics: Tracks processing history with search and filter capabilities
  • 🎨 Modern UI: Beautiful React frontend with real-time processing feedback

How to Use

  1. Upload Invoice: Upload a PDF, DOCX, or TXT invoice file
  2. Upload PO File: Upload a CSV or Excel file containing purchase order data
  3. Review Results: The AI agent will:
    • Extract invoice fields and line items
    • Match invoice lines to PO lines dynamically
    • Calculate backorders
    • Validate supplier
    • Detect duplicates
    • Provide approval decision (Approved/Partially Approved/Rejected)

Environment Variables

Set these in your Hugging Face Space settings:

  • AZURE_OPENAI_ENDPOINT: Your Azure OpenAI endpoint
  • AZURE_OPENAI_API_KEY: Your Azure OpenAI API key
  • AZURE_OPENAI_DEPLOYMENT: Your Azure OpenAI deployment name
  • AZURE_OPENAI_API_VERSION: (Optional) API version, defaults to 2024-10-21

Optional (for real OCR on scanned invoices):

  • AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT: Azure Document Intelligence endpoint
  • AZURE_DOCUMENT_INTELLIGENCE_KEY: Azure Document Intelligence key

Technical Details

  • Backend: FastAPI (Python)
  • Frontend: React + TypeScript + Tailwind CSS
  • AI: Azure OpenAI (GPT-4)
  • Database: SQLite (persistent storage)
  • Deployment: Docker on Hugging Face Spaces

License

MIT