Update app.py
Browse files
app.py
CHANGED
@@ -432,11 +432,11 @@ st.markdown("---")
|
|
432 |
url_text = st.text_input("Please Enter a url here")
|
433 |
|
434 |
if url_text:
|
435 |
-
article_title,
|
436 |
|
437 |
article_text = st.text_area(
|
438 |
label='Full Article Text',
|
439 |
-
value=
|
440 |
placeholder="Full article text will be displayed here..",
|
441 |
height=250
|
442 |
)
|
@@ -458,10 +458,10 @@ upload_doc = st.file_uploader(
|
|
458 |
)
|
459 |
|
460 |
if plain_text:
|
461 |
-
_,
|
462 |
|
463 |
elif upload_doc:
|
464 |
-
_,
|
465 |
|
466 |
summarize = st.button("Summarize")
|
467 |
|
@@ -469,9 +469,9 @@ summarize = st.button("Summarize")
|
|
469 |
if summarize:
|
470 |
if model_type == "Facebook-Bart":
|
471 |
if url_text:
|
472 |
-
text_to_summarize =
|
473 |
else:
|
474 |
-
text_to_summarize =
|
475 |
|
476 |
with st.spinner(
|
477 |
text="Loading Facebook-Bart Model and Extracting summary. This might take a few seconds depending on the length of your text..."
|
@@ -482,9 +482,9 @@ if summarize:
|
|
482 |
|
483 |
elif model_type == "Sshleifer-DistilBart":
|
484 |
if url_text:
|
485 |
-
text_to_summarize =
|
486 |
else:
|
487 |
-
text_to_summarize =
|
488 |
|
489 |
with st.spinner(
|
490 |
text="Loading Sshleifer-DistilBart Model and Extracting summary. This might take a few seconds depending on the length of your text..."
|
@@ -495,7 +495,7 @@ if summarize:
|
|
495 |
|
496 |
with st.spinner("Calculating and matching entities, this takes a few seconds..."):
|
497 |
|
498 |
-
entity_match_html = highlight_entities(
|
499 |
st.subheader("Summarized text with matched entities in Green and mismatched entities in Red relative to the original text")
|
500 |
st.markdown("####")
|
501 |
|
|
|
432 |
url_text = st.text_input("Please Enter a url here")
|
433 |
|
434 |
if url_text:
|
435 |
+
article_title, cleaned_text = clean_text(url_text, url=True)
|
436 |
|
437 |
article_text = st.text_area(
|
438 |
label='Full Article Text',
|
439 |
+
value= cleaned_text,
|
440 |
placeholder="Full article text will be displayed here..",
|
441 |
height=250
|
442 |
)
|
|
|
458 |
)
|
459 |
|
460 |
if plain_text:
|
461 |
+
_, cleaned_text = clean_text(plain_text,plain_text=True)
|
462 |
|
463 |
elif upload_doc:
|
464 |
+
_, cleaned_text = clean_text(plain_text,doc=True)
|
465 |
|
466 |
summarize = st.button("Summarize")
|
467 |
|
|
|
469 |
if summarize:
|
470 |
if model_type == "Facebook-Bart":
|
471 |
if url_text:
|
472 |
+
text_to_summarize =cleaned_text
|
473 |
else:
|
474 |
+
text_to_summarize = cleaned_text
|
475 |
|
476 |
with st.spinner(
|
477 |
text="Loading Facebook-Bart Model and Extracting summary. This might take a few seconds depending on the length of your text..."
|
|
|
482 |
|
483 |
elif model_type == "Sshleifer-DistilBart":
|
484 |
if url_text:
|
485 |
+
text_to_summarize = cleaned_text
|
486 |
else:
|
487 |
+
text_to_summarize = cleaned_text
|
488 |
|
489 |
with st.spinner(
|
490 |
text="Loading Sshleifer-DistilBart Model and Extracting summary. This might take a few seconds depending on the length of your text..."
|
|
|
495 |
|
496 |
with st.spinner("Calculating and matching entities, this takes a few seconds..."):
|
497 |
|
498 |
+
entity_match_html = highlight_entities(cleaned_text,summarized_text)
|
499 |
st.subheader("Summarized text with matched entities in Green and mismatched entities in Red relative to the original text")
|
500 |
st.markdown("####")
|
501 |
|