Spaces:
Sleeping
Sleeping
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() | |