carisackc commited on
Commit
1ed7511
1 Parent(s): 308d221

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -121,12 +121,28 @@ with col4:
121
  #nav_page('Social Notes')
122
  inputNote = "Input Social Note"
123
 
124
-
125
- #runtext =st.text_area('Input note here:', str(original_text2), height=300)
126
  runtext =st.text_area(inputNote, str(original_text2), height=300)
127
 
128
-
129
- def run_model(input_text):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  if model == "BertSummarizer":
132
  output = original_text['BertSummarizer'].values
@@ -165,7 +181,7 @@ with col1:
165
  st.button('Summarize')
166
  run_model(runtext)
167
  sentences=runtext.split('.')
168
- #st.text_area('Reference text', str(reference_text))#,label_visibility="hidden")
169
  with col2:
170
  st.button('NER')
171
  doc = nlp(str(original_text2))
@@ -177,7 +193,8 @@ with col2:
177
 
178
  col3, col4 = st.columns(2)
179
  with col3:
180
- st.text_area('Reference text', str(reference_text))#,label_visibility="hidden")
 
181
  with col4:
182
  st.text_area('testing', str(reference_text))#,label_visibility="hidden")
183
 
 
121
  #nav_page('Social Notes')
122
  inputNote = "Input Social Note"
123
 
 
 
124
  runtext =st.text_area(inputNote, str(original_text2), height=300)
125
 
126
+ def visualize (run_text,output)
127
+ text =''
128
+ import spacy
129
+ from spacy.lang.en import English # updated
130
+ nlp=spacy.load('en_core_web_sm')
131
+ sentences=run_text.split('.')
132
+ summary=output.split('.')
133
+
134
+ text = ''
135
+
136
+ display(HTML(f'<h1>Summary - {title}</h1>'))
137
+ for sentence in sentence_list:
138
+ if sentence in best_sentences:
139
+ text += ' ' + str(sentence).replace(sentence, f"<mark>{sentence}</mark>")
140
+ else:
141
+ text += ' ' + sentence
142
+ display(HTML(f""" {text} """))
143
+ best_sentences = []
144
+ for sentence in summary:
145
+ best_sentences.append(str(sentence))
146
 
147
  if model == "BertSummarizer":
148
  output = original_text['BertSummarizer'].values
 
181
  st.button('Summarize')
182
  run_model(runtext)
183
  sentences=runtext.split('.')
184
+ st.text_area('Reference text', str(reference_text))#,label_visibility="hidden")
185
  with col2:
186
  st.button('NER')
187
  doc = nlp(str(original_text2))
 
193
 
194
  col3, col4 = st.columns(2)
195
  with col3:
196
+ st.text_area(visualize (run_text,output))
197
+
198
  with col4:
199
  st.text_area('testing', str(reference_text))#,label_visibility="hidden")
200