Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,7 @@ def process_pdf(pdf_file):
|
|
| 18 |
for page in pages:
|
| 19 |
text = page["text"]
|
| 20 |
|
|
|
|
| 21 |
if "ืฉื ืืืืง ืืืืืืื" not in text:
|
| 22 |
continue
|
| 23 |
|
|
@@ -58,7 +59,7 @@ def load_sample():
|
|
| 58 |
with gr.Blocks() as interface:
|
| 59 |
gr.Markdown(
|
| 60 |
"""
|
| 61 |
-
<div style="font-size:32px; font-weight:800; margin-bottom:
|
| 62 |
Mortgage OCR
|
| 63 |
</div>
|
| 64 |
<div style="font-size:16px; opacity:0.85; margin-bottom:20px;">
|
|
@@ -69,22 +70,24 @@ with gr.Blocks() as interface:
|
|
| 69 |
|
| 70 |
with gr.Row():
|
| 71 |
|
| 72 |
-
# LEFT COLUMN
|
| 73 |
with gr.Column(scale=1):
|
| 74 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
gr.Image(
|
| 77 |
SAMPLE_PREVIEW_IMAGE,
|
| 78 |
-
|
| 79 |
-
|
| 80 |
)
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
# RIGHT COLUMN โ MAIN APP
|
| 85 |
with gr.Column(scale=2):
|
| 86 |
-
pdf_input = gr.File(label="Upload Mortgage PDF")
|
| 87 |
-
|
| 88 |
extract_btn = gr.Button("Extract Data")
|
| 89 |
|
| 90 |
json_output = gr.Textbox(
|
|
|
|
| 18 |
for page in pages:
|
| 19 |
text = page["text"]
|
| 20 |
|
| 21 |
+
# HARD FILTER โ real loan pages only
|
| 22 |
if "ืฉื ืืืืง ืืืืืืื" not in text:
|
| 23 |
continue
|
| 24 |
|
|
|
|
| 59 |
with gr.Blocks() as interface:
|
| 60 |
gr.Markdown(
|
| 61 |
"""
|
| 62 |
+
<div style="font-size:32px; font-weight:800; margin-bottom:6px;">
|
| 63 |
Mortgage OCR
|
| 64 |
</div>
|
| 65 |
<div style="font-size:16px; opacity:0.85; margin-bottom:20px;">
|
|
|
|
| 70 |
|
| 71 |
with gr.Row():
|
| 72 |
|
| 73 |
+
# LEFT COLUMN
|
| 74 |
with gr.Column(scale=1):
|
| 75 |
+
pdf_input = gr.File(label="Upload Mortgage PDF")
|
| 76 |
+
|
| 77 |
+
load_sample_btn = gr.Button("Use sample PDF")
|
| 78 |
+
|
| 79 |
+
gr.Markdown(
|
| 80 |
+
"<div style='margin-top:12px; font-weight:600;'>Sample preview</div>"
|
| 81 |
+
)
|
| 82 |
|
| 83 |
gr.Image(
|
| 84 |
SAMPLE_PREVIEW_IMAGE,
|
| 85 |
+
show_label=False,
|
| 86 |
+
height=220 # ๐ force small thumbnail
|
| 87 |
)
|
| 88 |
|
| 89 |
+
# RIGHT COLUMN
|
|
|
|
|
|
|
| 90 |
with gr.Column(scale=2):
|
|
|
|
|
|
|
| 91 |
extract_btn = gr.Button("Extract Data")
|
| 92 |
|
| 93 |
json_output = gr.Textbox(
|