Update app.py
Browse files
app.py
CHANGED
@@ -252,12 +252,20 @@ def highlight_entities(article_content,summary_output):
|
|
252 |
markdown_end = "</mark>"
|
253 |
|
254 |
matched_entities, unmatched_entities = get_and_compare_entities(article_content,summary_output)
|
|
|
|
|
|
|
|
|
|
|
255 |
|
256 |
for entity in matched_entities:
|
257 |
summary_output = summary_output.replace(entity, markdown_start_green + entity + markdown_end)
|
258 |
|
259 |
for entity in unmatched_entities:
|
260 |
summary_output = summary_output.replace(entity, markdown_start_red + entity + markdown_end)
|
|
|
|
|
|
|
261 |
soup = BeautifulSoup(summary_output, features="html.parser")
|
262 |
|
263 |
return HTML_WRAPPER.format(soup)
|
@@ -454,8 +462,6 @@ if summarize:
|
|
454 |
summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
|
455 |
|
456 |
with st.spinner("Calculating and matching entities, this takes a few seconds..."):
|
457 |
-
print(text_to_summarize)
|
458 |
-
print(summarized_text)
|
459 |
entity_match_html = highlight_entities(text_to_summarize,summarized_text)
|
460 |
st.subheader("Summarized text with matched entities in Green and mismatched entities in Red relative to the Original Text")
|
461 |
st.markdown("####")
|
|
|
252 |
markdown_end = "</mark>"
|
253 |
|
254 |
matched_entities, unmatched_entities = get_and_compare_entities(article_content,summary_output)
|
255 |
+
|
256 |
+
print(matched_entities)
|
257 |
+
print(unmatched_entities)
|
258 |
+
print("")
|
259 |
+
print(summary_output)
|
260 |
|
261 |
for entity in matched_entities:
|
262 |
summary_output = summary_output.replace(entity, markdown_start_green + entity + markdown_end)
|
263 |
|
264 |
for entity in unmatched_entities:
|
265 |
summary_output = summary_output.replace(entity, markdown_start_red + entity + markdown_end)
|
266 |
+
|
267 |
+
print("")
|
268 |
+
print(summary_output)
|
269 |
soup = BeautifulSoup(summary_output, features="html.parser")
|
270 |
|
271 |
return HTML_WRAPPER.format(soup)
|
|
|
462 |
summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
|
463 |
|
464 |
with st.spinner("Calculating and matching entities, this takes a few seconds..."):
|
|
|
|
|
465 |
entity_match_html = highlight_entities(text_to_summarize,summarized_text)
|
466 |
st.subheader("Summarized text with matched entities in Green and mismatched entities in Red relative to the Original Text")
|
467 |
st.markdown("####")
|