Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -90,6 +90,9 @@ def run_ner(text: str):
|
|
| 90 |
label_idn = LABEL_MAP.get(label_id, raw_label)
|
| 91 |
word = ent["word"].replace("▁", " ").replace("##", "").strip()
|
| 92 |
|
|
|
|
|
|
|
|
|
|
| 93 |
bg = "#f0f4ff" if i % 2 == 0 else "#ffffff"
|
| 94 |
rows_html += f"""
|
| 95 |
<tr style="background:{bg};">
|
|
@@ -117,7 +120,7 @@ def run_ner(text: str):
|
|
| 117 |
# CSS kustom
|
| 118 |
CUSTOM_CSS = """
|
| 119 |
/* Kontainer utama */
|
| 120 |
-
.gradio-container { max-width:
|
| 121 |
|
| 122 |
/* Judul */
|
| 123 |
#app-title { text-align: center; margin-bottom: 4px; }
|
|
@@ -167,30 +170,17 @@ with gr.Blocks(css=CUSTOM_CSS, title="NusaBert NER") as demo:
|
|
| 167 |
elem_id="app-title",
|
| 168 |
)
|
| 169 |
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
gr.Markdown("###Input Teks")
|
| 182 |
-
text_input = gr.Textbox(
|
| 183 |
-
lines=8,
|
| 184 |
-
placeholder="Ketik atau tempel teks di sini…",
|
| 185 |
-
label="",
|
| 186 |
-
show_label=False,
|
| 187 |
-
)
|
| 188 |
-
analyze_btn = gr.Button("Lakukan Analisis", elem_id="analyze-btn")
|
| 189 |
-
|
| 190 |
-
gr.Markdown("###Hasil Analisis Entitas")
|
| 191 |
-
output_html = gr.HTML(
|
| 192 |
-
value="<p style='color:gray; font-size:14px;'>Hasil analisis akan muncul di sini.</p>"
|
| 193 |
-
)
|
| 194 |
|
| 195 |
# Hubungkan tombol contoh → input field
|
| 196 |
for btn, body in example_btns:
|
|
|
|
| 90 |
label_idn = LABEL_MAP.get(label_id, raw_label)
|
| 91 |
word = ent["word"].replace("▁", " ").replace("##", "").strip()
|
| 92 |
|
| 93 |
+
if not word:
|
| 94 |
+
continue
|
| 95 |
+
|
| 96 |
bg = "#f0f4ff" if i % 2 == 0 else "#ffffff"
|
| 97 |
rows_html += f"""
|
| 98 |
<tr style="background:{bg};">
|
|
|
|
| 120 |
# CSS kustom
|
| 121 |
CUSTOM_CSS = """
|
| 122 |
/* Kontainer utama */
|
| 123 |
+
.gradio-container { max-width: 100% !important; padding: 0 32px !important; }
|
| 124 |
|
| 125 |
/* Judul */
|
| 126 |
#app-title { text-align: center; margin-bottom: 4px; }
|
|
|
|
| 170 |
elem_id="app-title",
|
| 171 |
)
|
| 172 |
|
| 173 |
+
gr.Markdown("Contoh Teks")
|
| 174 |
+
for title, body in EXAMPLES:
|
| 175 |
+
btn = gr.Button(f"**{title}**\n\n{body}", elem_classes="example-btn")
|
| 176 |
+
example_btns.append((btn, body))
|
| 177 |
+
|
| 178 |
+
gr.Markdown("Input Teks")
|
| 179 |
+
text_input = gr.Textbox(...)
|
| 180 |
+
analyze_btn = gr.Button(...)
|
| 181 |
+
|
| 182 |
+
gr.Markdown("Hasil Analisis Entitas")
|
| 183 |
+
output_html = gr.HTML(...)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
# Hubungkan tombol contoh → input field
|
| 186 |
for btn, body in example_btns:
|