File size: 768 Bytes
c8d472e
fa803dc
a9b1adf
c8d472e
fa803dc
4ab2cd6
 
 
 
a9b1adf
 
 
 
a1903a9
fa803dc
 
1d6c160
fa803dc
1d6c160
 
a9b1adf
fa803dc
a1903a9
fa803dc
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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=[".png", ".jpg", ".jpeg"]),
    outputs=gr.JSON(label="Extracted KYC Fields"),
    title="🔍 Smart KYC OCR (Powered by PaddleOCR)",
    description="Upload an Aadhaar or PAN card image. The tool extracts structured KYC fields using PaddleOCR.",
    theme="dark"
)

if __name__ == "__main__":
    iface.launch()