Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,30 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
from PIL import Image
|
4 |
-
import json
|
5 |
|
6 |
-
def
|
7 |
-
|
8 |
-
|
9 |
-
lines = raw_text.split('\n')
|
10 |
-
result = {}
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
return {"error": str(e)}
|
23 |
-
|
24 |
-
gr.Interface(
|
25 |
-
fn=extract_fields,
|
26 |
-
inputs=gr.Image(type="pil"),
|
27 |
-
outputs="json",
|
28 |
-
title="Smart KYC OCR (Tesseract)",
|
29 |
-
description="Upload Aadhaar or PAN image to extract key-value KYC fields using Tesseract OCR."
|
30 |
-
).launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from utils import extract_kyc_fields
|
|
|
|
|
3 |
|
4 |
+
def process_document(file):
|
5 |
+
result = extract_kyc_fields(file.read())
|
6 |
+
return result
|
|
|
|
|
7 |
|
8 |
+
iface = gr.Interface(
|
9 |
+
fn=process_document,
|
10 |
+
inputs=gr.File(label="Upload Aadhaar/PAN image", type="binary"),
|
11 |
+
outputs=gr.JSON(label="Extracted KYC Fields"),
|
12 |
+
title="Smart KYC OCR",
|
13 |
+
description="Upload an Aadhaar or PAN card image to extract structured KYC fields using Tesseract OCR"
|
14 |
+
)
|
15 |
|
16 |
+
if __name__ == "__main__":
|
17 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|