qanastek commited on
Commit
f25c9a1
1 Parent(s): bb1e2a5
Files changed (2) hide show
  1. app.py +2 -9
  2. requirements.txt +1 -2
app.py CHANGED
@@ -1,12 +1,10 @@
1
  import time
2
-
3
- import errant
4
  import streamlit as st
5
 
6
  from flair.data import Sentence
7
  from flair.models import SequenceTagger
8
 
9
- from highlighter import show_highlights
10
 
11
  checkpoints = [
12
  "qanastek/pos-french",
@@ -18,16 +16,11 @@ def get_model(model_name):
18
  # Load the model
19
  return SequenceTagger.load(model_name)
20
 
21
- @st.cache(suppress_st_warning=True, allow_output_mutation=True)
22
- def get_annotator(lang: str):
23
- return errant.load(lang)
24
-
25
 
26
  def main():
27
 
28
  st.title("🥖 French-Part-Of-Speech-Tagging")
29
 
30
- annotator = get_annotator("fr")
31
  checkpoint = st.selectbox("Choose model", checkpoints)
32
  model = get_model(checkpoint)
33
 
@@ -52,7 +45,7 @@ def main():
52
  result = sentence.to_tagged_string()
53
 
54
  try:
55
- show_highlights(annotator, input_text, result)
56
  st.write("")
57
  st.success(result)
58
  except Exception as e:
1
  import time
 
 
2
  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",
16
  # Load the model
17
  return SequenceTagger.load(model_name)
18
 
 
 
 
 
19
 
20
  def main():
21
 
22
  st.title("🥖 French-Part-Of-Speech-Tagging")
23
 
 
24
  checkpoint = st.selectbox("Choose model", checkpoints)
25
  model = get_model(checkpoint)
26
 
45
  result = sentence.to_tagged_string()
46
 
47
  try:
48
+ annotated_text(result)
49
  st.write("")
50
  st.success(result)
51
  except Exception as e:
requirements.txt CHANGED
@@ -1,5 +1,4 @@
1
  flair==0.8.0.post1
2
  beautifulsoup4
3
  pandas
4
- st-annotated-text
5
- errant
1
  flair==0.8.0.post1
2
  beautifulsoup4
3
  pandas
4
+ st-annotated-text