EC2 Default User commited on
Commit
cc00572
1 Parent(s): a6314b2
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -18,7 +18,7 @@ def load_tagger():
18
 
19
  def anonymise_text(text: str, metadata: str = "", white_listed_words: str = ""):
20
  """anonymise text"""
21
- if st.session_state.n_requests >= 5:
22
  st.session_state.text_error = "Too many requests. Please wait a few seconds before anonymising more text."
23
  logging.info(f"Session request limit reached: {st.session_state.n_requests}")
24
  st.session_state.n_requests = 1
@@ -30,7 +30,9 @@ def anonymise_text(text: str, metadata: str = "", white_listed_words: str = ""):
30
  if not text:
31
  st.session_state.text_error = "Please enter your text"
32
  return
33
-
 
 
34
  with text_spinner_placeholder:
35
  with st.spinner("Please wait while your text is being anonymised..."):
36
 
@@ -41,8 +43,6 @@ def anonymise_text(text: str, metadata: str = "", white_listed_words: str = ""):
41
  # return
42
 
43
  # else:
44
- # load tagger
45
- tagger = load_tagger()
46
  sentence = Sentence(text)
47
  # predict NER tags
48
  tagger.predict(sentence)
 
18
 
19
  def anonymise_text(text: str, metadata: str = "", white_listed_words: str = ""):
20
  """anonymise text"""
21
+ if st.session_state.n_requests >= 50:
22
  st.session_state.text_error = "Too many requests. Please wait a few seconds before anonymising more text."
23
  logging.info(f"Session request limit reached: {st.session_state.n_requests}")
24
  st.session_state.n_requests = 1
 
30
  if not text:
31
  st.session_state.text_error = "Please enter your text"
32
  return
33
+
34
+ # load tagger
35
+ tagger = load_tagger()
36
  with text_spinner_placeholder:
37
  with st.spinner("Please wait while your text is being anonymised..."):
38
 
 
43
  # return
44
 
45
  # else:
 
 
46
  sentence = Sentence(text)
47
  # predict NER tags
48
  tagger.predict(sentence)