Update
Browse files- app.py +6 -9
- requirements.txt +1 -4
app.py
CHANGED
@@ -3,8 +3,7 @@ import streamlit as st
|
|
3 |
|
4 |
from flair.data import Sentence
|
5 |
from flair.models import SequenceTagger
|
6 |
-
|
7 |
-
from annotated_text import annotated_text
|
8 |
|
9 |
checkpoints = [
|
10 |
"qanastek/pos-french",
|
@@ -36,18 +35,16 @@ def main():
|
|
36 |
with st.spinner("Search for Part-Of-Speech Tags π"):
|
37 |
|
38 |
# Build Sentence
|
39 |
-
|
40 |
|
41 |
# predict tags
|
42 |
-
model.predict(
|
43 |
|
44 |
-
# print predicted pos tags
|
45 |
-
result = sentence.to_tagged_string()
|
46 |
|
47 |
try:
|
48 |
-
|
49 |
-
st.write("")
|
50 |
-
st.success(result)
|
51 |
except Exception as e:
|
52 |
st.error("Some error occured!" + str(e))
|
53 |
st.stop()
|
|
|
3 |
|
4 |
from flair.data import Sentence
|
5 |
from flair.models import SequenceTagger
|
6 |
+
from flair.visual.ner_html import render_ner_html
|
|
|
7 |
|
8 |
checkpoints = [
|
9 |
"qanastek/pos-french",
|
|
|
35 |
with st.spinner("Search for Part-Of-Speech Tags π"):
|
36 |
|
37 |
# Build Sentence
|
38 |
+
s = Sentence(input_text)
|
39 |
|
40 |
# predict tags
|
41 |
+
model.predict(s)
|
42 |
|
43 |
+
# # print predicted pos tags
|
44 |
+
# result = sentence.to_tagged_string()
|
45 |
|
46 |
try:
|
47 |
+
st.write(render_ner_html(sentences=[s], wrap_page=False), unsafe_allow_html=True)
|
|
|
|
|
48 |
except Exception as e:
|
49 |
st.error("Some error occured!" + str(e))
|
50 |
st.stop()
|
requirements.txt
CHANGED
@@ -1,4 +1 @@
|
|
1 |
-
flair==0.8.0.post1
|
2 |
-
beautifulsoup4
|
3 |
-
pandas
|
4 |
-
st-annotated-text
|
|
|
1 |
+
flair==0.8.0.post1
|
|
|
|
|
|