Spaces:
Runtime error
Runtime error
spitzc32
commited on
Commit
·
c9c96ed
1
Parent(s):
9c95de0
reverted panel
Browse files
app.py
CHANGED
@@ -4,8 +4,6 @@ import panel as pn
|
|
4 |
|
5 |
pn.extension()
|
6 |
pn.extension('tabulator')
|
7 |
-
import warnings
|
8 |
-
warnings.filterwarnings('ignore')
|
9 |
|
10 |
|
11 |
# Variables for Interactive selections
|
@@ -34,15 +32,18 @@ def model(word: str):
|
|
34 |
tagger.predict(txt)
|
35 |
labels, tags = [], []
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
41 |
#return pn.pane.Markdown(f"""{
|
42 |
# 'labels': {labels},
|
43 |
# 'tags': {tags}
|
44 |
# }""")
|
45 |
-
return pn.pane.Markdown(
|
46 |
|
47 |
def get_tag_results(_):
|
48 |
return pn.Column(
|
@@ -60,7 +61,7 @@ template = pn.template.FastListTemplate(
|
|
60 |
button,
|
61 |
text_widget
|
62 |
],
|
63 |
-
main=[interactive],
|
64 |
accent_base_color="#88d8b0",
|
65 |
header_background="#88d8b0",
|
66 |
)
|
|
|
4 |
|
5 |
pn.extension()
|
6 |
pn.extension('tabulator')
|
|
|
|
|
7 |
|
8 |
|
9 |
# Variables for Interactive selections
|
|
|
32 |
tagger.predict(txt)
|
33 |
labels, tags = [], []
|
34 |
|
35 |
+
for entity in txt.get_spans('ner'):
|
36 |
+
labels.append(entity.text)
|
37 |
+
tags.append(entity.get_label("ner").value)
|
38 |
+
message = f"""
|
39 |
+
'labels': {labels},
|
40 |
+
'tags': {tags}
|
41 |
+
"""
|
42 |
#return pn.pane.Markdown(f"""{
|
43 |
# 'labels': {labels},
|
44 |
# 'tags': {tags}
|
45 |
# }""")
|
46 |
+
return pn.pane.Markdown(message)
|
47 |
|
48 |
def get_tag_results(_):
|
49 |
return pn.Column(
|
|
|
61 |
button,
|
62 |
text_widget
|
63 |
],
|
64 |
+
main=[pn.panel(interactive, loading_indicator=True)],
|
65 |
accent_base_color="#88d8b0",
|
66 |
header_background="#88d8b0",
|
67 |
)
|