ajitrajasekharan commited on
Commit
23a2b0d
·
1 Parent(s): 281974e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -117,16 +117,16 @@ def perform_inference(text,display_area):
117
 
118
 
119
  if (st.session_state['ner_phi'] is None):
120
- display_area.text("Initializing PHI module...")
121
  st.session_state['ner_phi'] = ner.UnsupNER("bbc/ner_bbc_config.json")
122
 
123
 
124
 
125
 
126
 
127
- display_area.text("Getting results from PHI model...")
128
  phi_results = st.session_state['phi_model'].get_descriptors(text,pos_arr)
129
- display_area.text("Aggregating BIO & PHI results...")
130
 
131
  phi_ner = st.session_state['ner_phi'].tag_sentence_service(text,phi_results)
132
 
@@ -143,12 +143,13 @@ sent_arr = [
143
  "I met my two friends at the pub",
144
  "The sky turned dark in advance of the storm that was coming from the east ",
145
  "She loves to watch Sunday afternoon football with her family ",
 
146
  "Paul Erdos died at 83 "
147
  ]
148
 
149
 
150
  sent_arr_masked = [
151
- "John:__entity__ Doe:__entity__ flew from New York to Rio:__entity__ De:__entity__ Janiro:__entity__ ",
152
  "In 2020:__entity__, Catherine:__entity__ Zeta:__entity__ Jones:__entity__ participated in the Winter:__entity__ Olympics:__entity__ and came third in Ice:__entity__ hockey:__entity__",
153
  "Stanford:__entity__ called",
154
  "I met my girl:__entity__ friends at the pub ",
@@ -157,6 +158,7 @@ sent_arr_masked = [
157
  "I met my two:__entity__ friends at the pub",
158
  "The sky turned dark:__entity__ in advance of the storm that was coming from the east ",
159
  "She loves to watch Sunday afternoon football:__entity__ with her family ",
 
160
  "Paul:__entity__ Erdos:__entity__ died at 83:__entity__ "
161
  ]
162
 
 
117
 
118
 
119
  if (st.session_state['ner_phi'] is None):
120
+ display_area.text("Initializing BERT module...")
121
  st.session_state['ner_phi'] = ner.UnsupNER("bbc/ner_bbc_config.json")
122
 
123
 
124
 
125
 
126
 
127
+ display_area.text("Getting predictions from BERT model...")
128
  phi_results = st.session_state['phi_model'].get_descriptors(text,pos_arr)
129
+ display_area.text("Computing NER results...")
130
 
131
  phi_ner = st.session_state['ner_phi'].tag_sentence_service(text,phi_results)
132
 
 
143
  "I met my two friends at the pub",
144
  "The sky turned dark in advance of the storm that was coming from the east ",
145
  "She loves to watch Sunday afternoon football with her family ",
146
+ "The United States has the largest prison population in the world, and the highest per-capita incarceration rate",
147
  "Paul Erdos died at 83 "
148
  ]
149
 
150
 
151
  sent_arr_masked = [
152
+ "John:__entity__ Doe:__entity__ flew from New:__entity__ York:__entity__ to Rio:__entity__ De:__entity__ Janiro:__entity__ ",
153
  "In 2020:__entity__, Catherine:__entity__ Zeta:__entity__ Jones:__entity__ participated in the Winter:__entity__ Olympics:__entity__ and came third in Ice:__entity__ hockey:__entity__",
154
  "Stanford:__entity__ called",
155
  "I met my girl:__entity__ friends at the pub ",
 
158
  "I met my two:__entity__ friends at the pub",
159
  "The sky turned dark:__entity__ in advance of the storm that was coming from the east ",
160
  "She loves to watch Sunday afternoon football:__entity__ with her family ",
161
+ "The United:__entity__ States:__entity__ has the largest prison population in the world, and the highest per-capita incarceration:__entity__ rate:__entity__",
162
  "Paul:__entity__ Erdos:__entity__ died at 83:__entity__ "
163
  ]
164