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
- Ubuntu:
- Google Gemini API Key
Setup
-
Clone the repository
git clone <repo-url> cd cc-poc
-
Install Dependencies
pip install -r requirements.txt
-
Environment Variables Create a
.envfile 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fe3b4bc7bdc21ce3dbed8e76cfaeff2e38d06b280652a58eb0ec29ce7875eba
|
|
| MD5 |
2a39f959e02472ed28a236395b8eab16
|
|
| BLAKE2b-256 |
c11fba88da12c4eea026653ea2f19df65aafd49d5bfc95ab180880d080ae1a7b
|
Provenance
The following attestation bundles were made for kyc_extractor_ai-0.1.0.tar.gz:
Publisher:
publish.yml on arvi1999/kyc-extractor-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kyc_extractor_ai-0.1.0.tar.gz -
Subject digest:
6fe3b4bc7bdc21ce3dbed8e76cfaeff2e38d06b280652a58eb0ec29ce7875eba - Sigstore transparency entry: 731694619
- Sigstore integration time:
-
Permalink:
arvi1999/kyc-extractor-ai@bb378944f620adc2d653e2b791fdbb20d8ecc53a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/arvi1999
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb378944f620adc2d653e2b791fdbb20d8ecc53a -
Trigger Event:
release
-
Statement type:
File details
Details for the file kyc_extractor_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kyc_extractor_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1c5caa734e0d959ba087d012f9a615834fe49b1b9d4e1e2a15f8031e260debb
|
|
| MD5 |
f75ff6e3876d14b41a9193eda545cb1e
|
|
| BLAKE2b-256 |
5c25a0cf17c7e833c93413211b9757843dec421391524362a5926850b1386f42
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kyc_extractor_ai-0.1.0-py3-none-any.whl -
Subject digest:
c1c5caa734e0d959ba087d012f9a615834fe49b1b9d4e1e2a15f8031e260debb - Sigstore transparency entry: 731694620
- Sigstore integration time:
-
Permalink:
arvi1999/kyc-extractor-ai@bb378944f620adc2d653e2b791fdbb20d8ecc53a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/arvi1999
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb378944f620adc2d653e2b791fdbb20d8ecc53a -
Trigger Event:
release
-
Statement type: