SMART_KYC_OCR / app.py
gopichandra's picture
Update app.py
a9b1adf verified
raw
history blame
889 Bytes
import gradio as gr
from utils import extract_kyc_fields
import traceback
def process_document(file):
try:
result = extract_kyc_fields(file.name)
return result
except Exception as e:
return {
"error": f"Failed to process image.\n{str(e)}",
"traceback": traceback.format_exc()
}
iface = gr.Interface(
fn=process_document,
inputs=gr.File(
label="Upload Aadhaar/PAN image",
file_types=[".jpg", ".jpeg", ".png", ".webp", ".tiff", ".bmp"]
),
outputs=gr.JSON(label="Extracted KYC Fields"),
title="🔍 Smart KYC OCR",
description=(
"Upload an image of an Aadhaar or PAN card, and this tool will extract key KYC fields like "
"**Name**, **Aadhaar Number**, and **Date of Birth** using Tesseract OCR."
),
theme="dark"
)
if __name__ == "__main__":
iface.launch()