Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
494ad77
1
Parent(s):
8cb97ec
Update app.py
Browse files
app.py
CHANGED
@@ -214,12 +214,14 @@ def classify_tokens(text):
|
|
214 |
|
215 |
color = color_dict.get(label, "#D3D3D3")
|
216 |
tooltip = f"{label} ({score:.2f})"
|
|
|
|
|
217 |
output += (
|
218 |
f"<span style='background-color: {color}; padding: 2px; border-radius: 4px;' "
|
219 |
-
f"title='{tooltip}'>{
|
220 |
)
|
221 |
-
last_idx = end
|
222 |
|
|
|
223 |
output += html.escape(text[last_idx:])
|
224 |
|
225 |
|
@@ -269,20 +271,4 @@ iface = gr.Interface(
|
|
269 |
theme="default"
|
270 |
)
|
271 |
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
# iface = gr.Interface(
|
277 |
-
# fn=classify_tokens,
|
278 |
-
# inputs=gr.Textbox(lines=4, placeholder="Enter a sentence...", label="Input Text"),
|
279 |
-
# outputs=[
|
280 |
-
# gr.HTML(label="SNACS Tagged Sentence"),
|
281 |
-
# gr.Dataframe(headers=["Token", "SNACS Label", "Confidence"], label="SNACS Table")
|
282 |
-
# ],
|
283 |
-
# title="SNACS Classification",
|
284 |
-
# description="SNACS Classification. Now Multilingual! See the <a href='https://arxiv.org/abs/1704.02134'>SNACS guidelines</a> for details.",
|
285 |
-
# theme="default"
|
286 |
-
# )
|
287 |
-
|
288 |
iface.launch()
|
|
|
214 |
|
215 |
color = color_dict.get(label, "#D3D3D3")
|
216 |
tooltip = f"{label} ({score:.2f})"
|
217 |
+
word_with_label = f"{word}_{label}"
|
218 |
+
|
219 |
output += (
|
220 |
f"<span style='background-color: {color}; padding: 2px; border-radius: 4px;' "
|
221 |
+
f"title='{tooltip}'>{word_with_label}</span>"
|
222 |
)
|
|
|
223 |
|
224 |
+
last_idx = end
|
225 |
output += html.escape(text[last_idx:])
|
226 |
|
227 |
|
|
|
271 |
theme="default"
|
272 |
)
|
273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
iface.launch()
|