Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -113,29 +113,6 @@ runtext =st.text_area('Input Clinical Note here:', str(original_text2), height=3
|
|
113 |
reference_text = original_text['Reference_text'].values
|
114 |
|
115 |
|
116 |
-
|
117 |
-
## ===== to highlight text =====
|
118 |
-
from IPython.core.display import HTML, display
|
119 |
-
def visualize(title, sentence_list, best_sentences):
|
120 |
-
text = ''
|
121 |
-
|
122 |
-
#display(HTML(f'<h1>Summary - {title}</h1>'))
|
123 |
-
for sentence in sentence_list:
|
124 |
-
if sentence in best_sentences:
|
125 |
-
#text += ' ' + str(sentence).replace(sentence, f"<mark>{sentence}</mark>")
|
126 |
-
text += ' ' + str(sentence).replace(sentence, f"<span class='highlight yellow'>{sentence}</span>")
|
127 |
-
else:
|
128 |
-
text += ' ' + sentence
|
129 |
-
display(HTML(f""" {text} """))
|
130 |
-
|
131 |
-
output = ''
|
132 |
-
best_sentences = []
|
133 |
-
for sentence in output:
|
134 |
-
#print(sentence)
|
135 |
-
best_sentences.append(str(sentence))
|
136 |
-
return text
|
137 |
-
# try this web solution https://discuss.streamlit.io/t/colored-boxes-around-sections-of-a-sentence/3201/2
|
138 |
-
|
139 |
#===== Pysummarization =====
|
140 |
from pysummarization.nlpbase.auto_abstractor import AutoAbstractor
|
141 |
from pysummarization.tokenizabledoc.simple_tokenizer import SimpleTokenizer
|
@@ -351,6 +328,6 @@ if st.button('Submit'):
|
|
351 |
# runtext2=runtext.split('.')
|
352 |
# reference_text2=reference_text.split('.')
|
353 |
|
354 |
-
st.write(visualize('of text', runtext ,reference_text))
|
355 |
|
356 |
st.text_area('Reference text', str(reference_text))
|
|
|
113 |
reference_text = original_text['Reference_text'].values
|
114 |
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
#===== Pysummarization =====
|
117 |
from pysummarization.nlpbase.auto_abstractor import AutoAbstractor
|
118 |
from pysummarization.tokenizabledoc.simple_tokenizer import SimpleTokenizer
|
|
|
328 |
# runtext2=runtext.split('.')
|
329 |
# reference_text2=reference_text.split('.')
|
330 |
|
331 |
+
# st.write(visualize('of text', runtext ,reference_text))
|
332 |
|
333 |
st.text_area('Reference text', str(reference_text))
|