nickmuchi commited on
Commit
5f40cae
·
1 Parent(s): 14bbe97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
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, clean_text = clean_text(url_text, url=True)
436
 
437
  article_text = st.text_area(
438
  label='Full Article Text',
439
- value= clean_text[0],
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
- _, clean_text = clean_text(plain_text,plain_text=True)
462
 
463
  elif upload_doc:
464
- _, clean_text = clean_text(plain_text,doc=True)
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 =clean_text
473
  else:
474
- text_to_summarize = clean_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,9 +482,9 @@ if summarize:
482
 
483
  elif model_type == "Sshleifer-DistilBart":
484
  if url_text:
485
- text_to_summarize = url_clean_text
486
  else:
487
- text_to_summarize = clean_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,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(clean_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
 
 
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