carisackc commited on
Commit
d35f2a7
·
1 Parent(s): 56e867e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -108,7 +108,7 @@ countOfAdmission = len(pastHistoryEpDate)
108
 
109
 
110
  # List of Model available
111
- model = st.sidebar.selectbox('Select Model', ('BertSummarizer','BertGPT2','t5seq2eq','t5','gensim','pysummarizer'))
112
 
113
  # ===== to display selected patient and admission id on main page
114
  col3,col4 = st.columns(2)
@@ -205,7 +205,18 @@ if not(btnPastHistory) and not(btnDailyNarrative):
205
  # entlist = ",".join(ent)
206
  # st.markdown(f'<p style="background-color:{ent_col[entity]};color:#080808;font-size:16px;">{entlist}</p>', #unsafe_allow_html=True)
207
 
 
208
 
 
 
 
 
 
 
 
 
 
 
209
  ##======================== Start of NER Tagging ========================
210
  # ====== Old NER ======
211
  # doc = nlp(str(original_text2))
@@ -301,14 +312,16 @@ ent_html = displacy.render(doc0, style='ent', options=options)
301
 
302
  def run_model(input_text):
303
  if model == "BertSummarizer":
304
- output = original_text['BertSummarizer2s'].values
 
 
305
  st.write('Summary')
306
-
 
307
  elif model == "BertGPT2":
308
  output = original_text['BertGPT2'].values
309
  st.write('Summary')
310
-
311
-
312
  elif model == "t5seq2eq":
313
  output = original_text['t5seq2eq'].values
314
  st.write('Summary')
 
108
 
109
 
110
  # List of Model available
111
+ model = st.sidebar.selectbox('Select Model', ('BertSummarizer'))
112
 
113
  # ===== to display selected patient and admission id on main page
114
  col3,col4 = st.columns(2)
 
205
  # entlist = ",".join(ent)
206
  # st.markdown(f'<p style="background-color:{ent_col[entity]};color:#080808;font-size:16px;">{entlist}</p>', #unsafe_allow_html=True)
207
 
208
+ ##===== BERT Summary tokenizer =====
209
 
210
+ def BertSummarizer(input_text):
211
+ from transformers import BigBirdTokenizer
212
+ from summarizer import Summarizer
213
+
214
+ bertsummarizer = Summarizer()
215
+
216
+ model = Summarizer()
217
+ result = model(input_text,ratio=0.4)
218
+
219
+ return result
220
  ##======================== Start of NER Tagging ========================
221
  # ====== Old NER ======
222
  # doc = nlp(str(original_text2))
 
312
 
313
  def run_model(input_text):
314
  if model == "BertSummarizer":
315
+ # output = original_text['BertSummarizer2s'].values
316
+ # st.write('Summary')
317
+ output = BertSummarizer(input_text)
318
  st.write('Summary')
319
+ st.success(output)
320
+
321
  elif model == "BertGPT2":
322
  output = original_text['BertGPT2'].values
323
  st.write('Summary')
324
+
 
325
  elif model == "t5seq2eq":
326
  output = original_text['t5seq2eq'].values
327
  st.write('Summary')