ajitrajasekharan commited on
Commit
281974e
·
1 Parent(s): 90a2a07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -29
app.py CHANGED
@@ -83,12 +83,8 @@ def init_session_states():
83
  st.session_state['top_k'] = 20
84
  if 'pos_model' not in st.session_state:
85
  st.session_state['pos_model'] = None
86
- if 'bio_model' not in st.session_state:
87
- st.session_state['bio_model'] = None
88
  if 'phi_model' not in st.session_state:
89
  st.session_state['phi_model'] = None
90
- if 'ner_bio' not in st.session_state:
91
- st.session_state['ner_bio'] = None
92
  if 'ner_phi' not in st.session_state:
93
  st.session_state['ner_phi'] = None
94
  if 'aggr' not in st.session_state:
@@ -98,7 +94,7 @@ def init_session_states():
98
 
99
  def get_pos_arr(input_text,display_area):
100
  if (st.session_state['pos_model'] is None):
101
- display_area.text("Loading model 3 of 3.Loading POS model...")
102
  st.session_state['pos_model'] = load_pos_model()
103
  s = Sentence(input_text)
104
  st.session_state['pos_model'].predict(s)
@@ -110,7 +106,7 @@ def perform_inference(text,display_area):
110
 
111
 
112
  if (st.session_state['phi_model'] is None):
113
- display_area.text("Loading model 2 of 3. PHI model...")
114
  st.session_state['phi_model'] = bd.BatchInference("bbc/desc_bbc_config.json",'bert-base-cased',False,False,DEFAULT_TOP_K,True,True, "bbc/","bbc/bbc_labels.txt",False)
115
 
116
  #Load POS model if needed and gets POS tags
@@ -138,22 +134,13 @@ def perform_inference(text,display_area):
138
 
139
 
140
  sent_arr = [
141
- "Lou Gehrig who works for XCorp and lives in New York suffers from Parkinson's ",
142
- "Parkinson who works for XCorp and lives in New York suffers from Lou Gehrig's",
143
- "lou gehrig was diagnosed with Parkinson's ",
144
- "A eGFR below 60 indicates chronic kidney disease",
145
- "Overexpression of EGFR occurs across a wide range of different cancers",
146
  "Stanford called",
147
- "He was diagnosed with non small cell lung cancer",
148
  "I met my girl friends at the pub ",
149
  "I met my New York friends at the pub",
150
  "I met my XCorp friends at the pub",
151
  "I met my two friends at the pub",
152
- "Bio-Techne's genomic tools include advanced tissue-based in-situ hybridization assays sold under the ACD brand as well as a portfolio of assays for prostate cancer diagnosis ",
153
- "There are no treatment options specifically indicated for ACD and physicians must utilize agents approved for other dermatology conditions", "As ACD has been implicated in apoptosis-resistant glioblastoma (GBM), there is a high medical need for identifying novel ACD-inducing drugs ",
154
- "Located in the heart of Dublin , in the family home of acclaimed writer Oscar Wilde , ACD provides the perfect backdrop to inspire Irish (and Irish-at-heart) students to excel in business and the arts",
155
- "Patients treated with anticancer chemotherapy drugs ( ACD ) are vulnerable to infectious diseases due to immunosuppression and to the direct impact of ACD on their intestinal microbiota ",
156
- "In the LASOR trial , increasing daily imatinib dose from 400 to 600mg induced MMR at 12 and 24 months in 25% and 36% of the patients, respectively, who had suboptimal cytogenetic responses ",
157
  "The sky turned dark in advance of the storm that was coming from the east ",
158
  "She loves to watch Sunday afternoon football with her family ",
159
  "Paul Erdos died at 83 "
@@ -161,23 +148,13 @@ sent_arr = [
161
 
162
 
163
  sent_arr_masked = [
164
- "Lou Gehrig:__entity__ who works for XCorp:__entity__ and lives in New:__entity__ York:__entity__ suffers from Parkinson's:__entity__ ",
165
- "Parkinson:__entity__ who works for XCorp:__entity__ and lives in New:__entity__ York:__entity__ suffers from Lou Gehrig's:__entity__",
166
- "lou:__entity__ gehrig:__entity__ was diagnosed with Parkinson's:__entity__ ",
167
- "A eGFR:__entity__ below 60 indicates chronic kidney disease",
168
- "Overexpression of EGFR:__entity__ occurs across a wide range of different cancers",
169
  "Stanford:__entity__ called",
170
- "He was diagnosed with non:__entity__ small:__entity__ cell:__entity__ lung:__entity__ cancer:__entity__",
171
  "I met my girl:__entity__ friends at the pub ",
172
  "I met my New:__entity__ York:__entity__ friends at the pub",
173
  "I met my XCorp:__entity__ friends at the pub",
174
  "I met my two:__entity__ friends at the pub",
175
- "Bio-Techne's genomic tools include advanced tissue-based in-situ hybridization assays sold under the ACD:__entity__ brand as well as a portfolio of assays for prostate cancer diagnosis ",
176
- "There are no treatment options specifically indicated for ACD:__entity__ and physicians must utilize agents approved for other dermatology conditions",
177
- "As ACD:__entity__ has been implicated in apoptosis-resistant glioblastoma (GBM), there is a high medical need for identifying novel ACD-inducing drugs ",
178
- "Located in the heart of Dublin , in the family home of acclaimed writer Oscar Wilde , ACD:__entity__ provides the perfect backdrop to inspire Irish (and Irish-at-heart) students to excel in business and the arts",
179
- "Patients treated with anticancer chemotherapy drugs ( ACD:__entity__ ) are vulnerable to infectious diseases due to immunosuppression and to the direct impact of ACD on their intestinal microbiota ",
180
- "In the LASOR:__entity__ trial:__entity__ , increasing daily imatinib dose from 400 to 600mg induced MMR at 12 and 24 months in 25% and 36% of the patients, respectively, who had suboptimal cytogenetic responses ",
181
  "The sky turned dark:__entity__ in advance of the storm that was coming from the east ",
182
  "She loves to watch Sunday afternoon football:__entity__ with her family ",
183
  "Paul:__entity__ Erdos:__entity__ died at 83:__entity__ "
 
83
  st.session_state['top_k'] = 20
84
  if 'pos_model' not in st.session_state:
85
  st.session_state['pos_model'] = None
 
 
86
  if 'phi_model' not in st.session_state:
87
  st.session_state['phi_model'] = None
 
 
88
  if 'ner_phi' not in st.session_state:
89
  st.session_state['ner_phi'] = None
90
  if 'aggr' not in st.session_state:
 
94
 
95
  def get_pos_arr(input_text,display_area):
96
  if (st.session_state['pos_model'] is None):
97
+ display_area.text("Loading model 2 of 2.Loading POS model...")
98
  st.session_state['pos_model'] = load_pos_model()
99
  s = Sentence(input_text)
100
  st.session_state['pos_model'].predict(s)
 
106
 
107
 
108
  if (st.session_state['phi_model'] is None):
109
+ display_area.text("Loading model 1 of 2. PHI model...")
110
  st.session_state['phi_model'] = bd.BatchInference("bbc/desc_bbc_config.json",'bert-base-cased',False,False,DEFAULT_TOP_K,True,True, "bbc/","bbc/bbc_labels.txt",False)
111
 
112
  #Load POS model if needed and gets POS tags
 
134
 
135
 
136
  sent_arr = [
137
+ "John Doe flew from New York to Rio De Janiro ",
138
+ "In 2020, John participated in the Winter Olympics and came third in Ice hockey",
 
 
 
139
  "Stanford called",
 
140
  "I met my girl friends at the pub ",
141
  "I met my New York friends at the pub",
142
  "I met my XCorp friends at the pub",
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 "
 
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 ",
155
  "I met my New:__entity__ York:__entity__ friends at the pub",
156
  "I met my XCorp:__entity__ friends at the pub",
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__ "