Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import re
|
|
| 7 |
import time
|
| 8 |
import base64
|
| 9 |
|
| 10 |
-
# Load model
|
| 11 |
import time as _t
|
| 12 |
_t0 = _t.time()
|
| 13 |
ner = pipeline("ner", model="cahya/NusaBert-ner-v1.3", aggregation_strategy="simple")
|
|
@@ -48,7 +48,6 @@ LABEL_HEX = {
|
|
| 48 |
}
|
| 49 |
|
| 50 |
MAX_PDF_PAGES = 5
|
| 51 |
-
# NusaBERT max 512 token ≈ ~400 kata ≈ ~2500 karakter aman
|
| 52 |
MAX_CHUNK_CHARS = 2000
|
| 53 |
OVERLAP_CHARS = 150
|
| 54 |
|
|
@@ -167,7 +166,6 @@ def _build_debug_html(lines: list) -> str:
|
|
| 167 |
{rows}
|
| 168 |
</div>"""
|
| 169 |
|
| 170 |
-
|
| 171 |
# NER Teks
|
| 172 |
def run_ner(text: str):
|
| 173 |
if not text or not text.strip():
|
|
@@ -469,9 +467,9 @@ with gr.Blocks(title="NER for Financial Statements", css=CUSTOM_CSS) as demo:
|
|
| 469 |
gr.HTML(
|
| 470 |
'''<div style="margin:0 0 16px;">
|
| 471 |
<p style="color:#94a3b8;font-family:DM Sans,sans-serif;font-size:13px;margin:0 0 8px;">
|
| 472 |
-
Unggah PDF laporan keuangan
|
| 473 |
-
Output
|
| 474 |
-
bisa dibuka di
|
| 475 |
</p>
|
| 476 |
<div style="background:rgba(251,191,36,0.1);border:1px solid rgba(251,191,36,0.4);
|
| 477 |
border-radius:8px;padding:8px 14px;display:flex;align-items:center;gap:8px;">
|
|
|
|
| 7 |
import time
|
| 8 |
import base64
|
| 9 |
|
| 10 |
+
# Load model
|
| 11 |
import time as _t
|
| 12 |
_t0 = _t.time()
|
| 13 |
ner = pipeline("ner", model="cahya/NusaBert-ner-v1.3", aggregation_strategy="simple")
|
|
|
|
| 48 |
}
|
| 49 |
|
| 50 |
MAX_PDF_PAGES = 5
|
|
|
|
| 51 |
MAX_CHUNK_CHARS = 2000
|
| 52 |
OVERLAP_CHARS = 150
|
| 53 |
|
|
|
|
| 166 |
{rows}
|
| 167 |
</div>"""
|
| 168 |
|
|
|
|
| 169 |
# NER Teks
|
| 170 |
def run_ner(text: str):
|
| 171 |
if not text or not text.strip():
|
|
|
|
| 467 |
gr.HTML(
|
| 468 |
'''<div style="margin:0 0 16px;">
|
| 469 |
<p style="color:#94a3b8;font-family:DM Sans,sans-serif;font-size:13px;margin:0 0 8px;">
|
| 470 |
+
Unggah PDF laporan keuangan maks 5 halaman.
|
| 471 |
+
Output berupa file.rtf dengan stabilo warna —
|
| 472 |
+
bisa dibuka di Microsoft Word atau LibreOffice.
|
| 473 |
</p>
|
| 474 |
<div style="background:rgba(251,191,36,0.1);border:1px solid rgba(251,191,36,0.4);
|
| 475 |
border-radius:8px;padding:8px 14px;display:flex;align-items:center;gap:8px;">
|