Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -276,7 +276,7 @@ def run_ner_pdf(pdf_file):
|
|
| 276 |
doc.save(out_path)
|
| 277 |
doc.close()
|
| 278 |
|
| 279 |
-
#
|
| 280 |
legend_rows = ""
|
| 281 |
for label_id in sorted(found_labels):
|
| 282 |
label_idn = LABEL_MAP.get(label_id, label_id)
|
|
@@ -321,7 +321,7 @@ def run_ner_pdf(pdf_file):
|
|
| 321 |
return out_path, legend_html, ""
|
| 322 |
|
| 323 |
|
| 324 |
-
#
|
| 325 |
CUSTOM_CSS = """
|
| 326 |
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@400;500;600&display=swap');
|
| 327 |
|
|
@@ -539,7 +539,7 @@ HERO_HTML = """
|
|
| 539 |
|
| 540 |
<p style="font-family:'DM Sans',sans-serif; font-size:clamp(13px,2vw,16px);
|
| 541 |
color:rgba(203,213,225,0.85); margin:0 auto 18px; max-width:640px; line-height:1.6;">
|
| 542 |
-
Implementasi
|
| 543 |
Laporan-laporan Keuangan Bahasa Indonesia
|
| 544 |
</p>
|
| 545 |
|
|
@@ -562,8 +562,8 @@ with gr.Blocks(title="NER for Financial Statements", css=CUSTOM_CSS) as demo:
|
|
| 562 |
|
| 563 |
with gr.Tabs(elem_classes="tab-nav"):
|
| 564 |
|
| 565 |
-
#
|
| 566 |
-
with gr.Tab("
|
| 567 |
|
| 568 |
with gr.Column(elem_id="center-col"):
|
| 569 |
gr.HTML('<div class="section-heading">Contoh Teks</div>')
|
|
@@ -579,22 +579,22 @@ with gr.Blocks(title="NER for Financial Statements", css=CUSTOM_CSS) as demo:
|
|
| 579 |
label="",
|
| 580 |
show_label=False,
|
| 581 |
)
|
| 582 |
-
analyze_btn = gr.Button("
|
| 583 |
|
| 584 |
gr.HTML('<div class="section-heading" style="margin-top:20px;">Hasil Analisis Entitas</div>')
|
| 585 |
text_output = gr.HTML(
|
| 586 |
value="<p style='color:#64748b; font-size:14px; font-family:DM Sans,sans-serif;"
|
| 587 |
-
"padding:20px; text-align:center;'>
|
| 588 |
)
|
| 589 |
|
| 590 |
-
#
|
| 591 |
-
with gr.Tab("
|
| 592 |
|
| 593 |
with gr.Column(elem_id="center-col"):
|
| 594 |
gr.HTML(
|
| 595 |
'<p style="color:#94a3b8; font-family:DM Sans,sans-serif; font-size:13px; '
|
| 596 |
'margin:0 0 16px;">'
|
| 597 |
-
'
|
| 598 |
'Entitas yang terdeteksi akan diberi warna berbeda di dalam PDF.</p>'
|
| 599 |
)
|
| 600 |
|
|
@@ -604,7 +604,7 @@ with gr.Blocks(title="NER for Financial Statements", css=CUSTOM_CSS) as demo:
|
|
| 604 |
file_types=[".pdf"],
|
| 605 |
type="filepath",
|
| 606 |
)
|
| 607 |
-
analyze_pdf_btn = gr.Button("
|
| 608 |
|
| 609 |
# Warning / error area
|
| 610 |
pdf_warning = gr.HTML(value="")
|
|
@@ -622,9 +622,9 @@ with gr.Blocks(title="NER for Financial Statements", css=CUSTOM_CSS) as demo:
|
|
| 622 |
"padding:16px; text-align:center;'>β¬ Unggah PDF lalu klik tombol Highlight.</p>"
|
| 623 |
)
|
| 624 |
|
| 625 |
-
gr.HTML('<div id="footer">NER for Financial Statements
|
| 626 |
|
| 627 |
-
#
|
| 628 |
for btn, body in example_btns:
|
| 629 |
btn.click(fn=lambda b=body: b, inputs=[], outputs=text_input)
|
| 630 |
|
|
|
|
| 276 |
doc.save(out_path)
|
| 277 |
doc.close()
|
| 278 |
|
| 279 |
+
# Build color legend table
|
| 280 |
legend_rows = ""
|
| 281 |
for label_id in sorted(found_labels):
|
| 282 |
label_idn = LABEL_MAP.get(label_id, label_id)
|
|
|
|
| 321 |
return out_path, legend_html, ""
|
| 322 |
|
| 323 |
|
| 324 |
+
# Custom CSS
|
| 325 |
CUSTOM_CSS = """
|
| 326 |
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@400;500;600&display=swap');
|
| 327 |
|
|
|
|
| 539 |
|
| 540 |
<p style="font-family:'DM Sans',sans-serif; font-size:clamp(13px,2vw,16px);
|
| 541 |
color:rgba(203,213,225,0.85); margin:0 auto 18px; max-width:640px; line-height:1.6;">
|
| 542 |
+
Implementasi Named Entity Recognition pada Kumpulan<br>
|
| 543 |
Laporan-laporan Keuangan Bahasa Indonesia
|
| 544 |
</p>
|
| 545 |
|
|
|
|
| 562 |
|
| 563 |
with gr.Tabs(elem_classes="tab-nav"):
|
| 564 |
|
| 565 |
+
# TAB 1 β TEXT INPUT
|
| 566 |
+
with gr.Tab("Analisis Teks"):
|
| 567 |
|
| 568 |
with gr.Column(elem_id="center-col"):
|
| 569 |
gr.HTML('<div class="section-heading">Contoh Teks</div>')
|
|
|
|
| 579 |
label="",
|
| 580 |
show_label=False,
|
| 581 |
)
|
| 582 |
+
analyze_btn = gr.Button("Lakukan Analisis", elem_id="analyze-btn")
|
| 583 |
|
| 584 |
gr.HTML('<div class="section-heading" style="margin-top:20px;">Hasil Analisis Entitas</div>')
|
| 585 |
text_output = gr.HTML(
|
| 586 |
value="<p style='color:#64748b; font-size:14px; font-family:DM Sans,sans-serif;"
|
| 587 |
+
"padding:20px; text-align:center;'>Masukkan teks lalu klik <strong>Lakukan Analisis</strong>.</p>"
|
| 588 |
)
|
| 589 |
|
| 590 |
+
# TAB 2 β PDF
|
| 591 |
+
with gr.Tab("Analisis PDF"):
|
| 592 |
|
| 593 |
with gr.Column(elem_id="center-col"):
|
| 594 |
gr.HTML(
|
| 595 |
'<p style="color:#94a3b8; font-family:DM Sans,sans-serif; font-size:13px; '
|
| 596 |
'margin:0 0 16px;">'
|
| 597 |
+
'Unggah PDF laporan keuangan (maks. <strong style="color:#a78bfa;">5 halaman</strong>). '
|
| 598 |
'Entitas yang terdeteksi akan diberi warna berbeda di dalam PDF.</p>'
|
| 599 |
)
|
| 600 |
|
|
|
|
| 604 |
file_types=[".pdf"],
|
| 605 |
type="filepath",
|
| 606 |
)
|
| 607 |
+
analyze_pdf_btn = gr.Button("Highlight Entitas PDF", elem_id="analyze-pdf-btn")
|
| 608 |
|
| 609 |
# Warning / error area
|
| 610 |
pdf_warning = gr.HTML(value="")
|
|
|
|
| 622 |
"padding:16px; text-align:center;'>β¬ Unggah PDF lalu klik tombol Highlight.</p>"
|
| 623 |
)
|
| 624 |
|
| 625 |
+
gr.HTML('<div id="footer">NER for Financial Statements 2026</div>')
|
| 626 |
|
| 627 |
+
# Wiring
|
| 628 |
for btn, body in example_btns:
|
| 629 |
btn.click(fn=lambda b=body: b, inputs=[], outputs=text_input)
|
| 630 |
|