nickmuchi commited on
Commit
21aa9ad
1 Parent(s): 6256cf1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -338,7 +338,7 @@ model_type = st.sidebar.selectbox(
338
  )
339
 
340
  max_len= st.sidebar.slider("Maximum length of the summarized text",min_value=80,max_value=500,step=10)
341
- min_len= st.sidebar.slider("Minimum length of the summarized text",min_value=10,step=10)
342
 
343
  st.markdown(
344
  "Model Source: [Facebook-Bart-large-CNN](https://huggingface.co/facebook/bart-large-cnn) and [Sshleifer-distilbart-cnn-12-6](https://huggingface.co/sshleifer/distilbart-cnn-12-6)"
@@ -422,8 +422,9 @@ if summarize:
422
  text="Loading Facebook-Bart Model and Extracting summary. This might take a few seconds depending on the length of your text..."
423
  ):
424
  summarizer_model = facebook_model()
425
- summarized_text = summarizer_model(text_to_summarize, max_length=max_len, min_length=min_len)
426
  summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
 
427
 
428
  elif model_type == "Sshleifer-DistilBart":
429
  if url_text:
@@ -453,10 +454,12 @@ if summarize:
453
  summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
454
 
455
  with st.spinner("Calculating and matching entities, this takes a few seconds..."):
456
-
 
457
  entity_match_html = highlight_entities(text_to_summarize,summarized_text)
458
  st.subheader("Summarized text with matched entities in Green and mismatched entities in Red relative to the Original Text")
459
  st.markdown("####")
 
460
 
461
  if article_title:
462
 
 
338
  )
339
 
340
  max_len= st.sidebar.slider("Maximum length of the summarized text",min_value=80,max_value=500,step=10)
341
+ min_len= st.sidebar.slider("Minimum length of the summarized text",min_value=40,step=10)
342
 
343
  st.markdown(
344
  "Model Source: [Facebook-Bart-large-CNN](https://huggingface.co/facebook/bart-large-cnn) and [Sshleifer-distilbart-cnn-12-6](https://huggingface.co/sshleifer/distilbart-cnn-12-6)"
 
422
  text="Loading Facebook-Bart Model and Extracting summary. This might take a few seconds depending on the length of your text..."
423
  ):
424
  summarizer_model = facebook_model()
425
+ summarized_text = summarizer_model(text_to_summarize, max_length=max_len, min_length=min_len,clean_up_tokenization_spaces=True,no_repeat_ngram_size=4)
426
  summarized_text = ' '.join([summ['summary_text'] for summ in summarized_text])
427
+
428
 
429
  elif model_type == "Sshleifer-DistilBart":
430
  if url_text:
 
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("####")
462
+ print(entity_match_html)
463
 
464
  if article_title:
465