RangGaraga commited on
Commit
744de7e
·
verified ·
1 Parent(s): fda56c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -7,7 +7,7 @@ import re
7
  import time
8
  import base64
9
 
10
- # Load model + warmup agar request pertama tidak lambat
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 (maks. <strong style="color:#a78bfa;">5 halaman</strong>).
473
- Output: file <strong style="color:#a78bfa;">.rtf</strong> dengan stabilo warna —
474
- bisa dibuka di <strong>Microsoft Word</strong> atau <strong>LibreOffice</strong>.
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;">