Skip to main content

AI-powered KYC Document Extraction using Google Gemini

Project description

Company Name Cleaning (CC) - POC

This project is a Proof of Concept (POC) for automatically extracting company details from KYC documents (GST, PAN, FSSAI, etc.) using Google Gemini Flash (Vision LLM).

Features

  • Multi-Format Support: Handles PDF (single & multi-page) and Images (JPG, PNG).
  • Intelligent Extraction: Uses Gemini 2.5 Flash to extract:
    • Company Name (Legal vs Trade Name)
    • Address (Bifurcated into Line 1, Locality, City, State, Pincode)
    • Identification Numbers (GSTIN, PAN, etc.)
    • Dates & Approver Names
  • Confidence Scoring: Returns a confidence score (0-1) and a reason for the score.
  • API: Fast, async-ready API built with FastAPI.

Prerequisites

  • Python 3.10+
  • poppler-utils (for PDF processing)
    • Ubuntu: sudo apt-get install poppler-utils
    • Mac: brew install poppler
  • Google Gemini API Key

Setup

  1. Clone the repository

    git clone <repo-url>
    cd cc-poc
    
  2. Install Dependencies

    pip install -r requirements.txt
    
  3. Environment Variables Create a .env file in the root directory:

    GOOGLE_API_KEY=your_actual_api_key_here
    

Usage

Running the API Server

uvicorn kyc_extractor.main:app --host 0.0.0.0 --port 8000 --reload

Testing the API

You can use the provided test script:

python scripts/test_api.py /path/to/document.pdf

Or use curl:

curl -X POST "http://localhost:8000/extract" \
     -H "accept: application/json" \
     -H "Content-Type: multipart/form-data" \
     -F "file=@/path/to/document.pdf"

Project Structure

  • kyc_extractor/: Core application code.
    • main.py: API endpoints.
    • core/: Config, Gemini client, and Prompts.
    • services/: Image processing logic.
    • schemas.py: Pydantic data models.
  • docs/: Documentation (PRD, Tech Doc, Plans).
  • scripts/: Utility scripts for testing.

Docker Support

Build and run with Docker Compose:

docker-compose up --build

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kyc_extractor_ai-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kyc_extractor_ai-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file kyc_extractor_ai-0.1.0.tar.gz.

File metadata

  • Download URL: kyc_extractor_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kyc_extractor_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6fe3b4bc7bdc21ce3dbed8e76cfaeff2e38d06b280652a58eb0ec29ce7875eba
MD5 2a39f959e02472ed28a236395b8eab16
BLAKE2b-256 c11fba88da12c4eea026653ea2f19df65aafd49d5bfc95ab180880d080ae1a7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for kyc_extractor_ai-0.1.0.tar.gz:

Publisher: publish.yml on arvi1999/kyc-extractor-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kyc_extractor_ai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kyc_extractor_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1c5caa734e0d959ba087d012f9a615834fe49b1b9d4e1e2a15f8031e260debb
MD5 f75ff6e3876d14b41a9193eda545cb1e
BLAKE2b-256 5c25a0cf17c7e833c93413211b9757843dec421391524362a5926850b1386f42

See more details on using hashes here.

Provenance

The following attestation bundles were made for kyc_extractor_ai-0.1.0-py3-none-any.whl:

Publisher: publish.yml on arvi1999/kyc-extractor-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page