smfaiz commited on
Commit
a1397bb
·
verified ·
1 Parent(s): 9205504

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -62,8 +62,8 @@ def extract_text_from_html(url):
62
  except Exception as e:
63
  return f"Error extracting text: {str(e)}"
64
 
65
- tokenizer_s = AutoTokenizer.from_pretrained("pszemraj/long-t5-tglobal-base-16384-book-summary")
66
- model_s = AutoModelForSeq2SeqLM.from_pretrained("pszemraj/long-t5-tglobal-base-16384-book-summary")
67
 
68
  def summarize_article(article_text):
69
  """Summarize a given article's text."""
@@ -82,10 +82,10 @@ def summarize_article(article_text):
82
  # Generate the summary
83
  summary_ids = model_s.generate(
84
  **inputs,
85
- max_new_tokens=400, # Limit the length of the output
86
  min_length=100, # Set a minimum length for the output
87
  # #length_penalty='1.0', # Adjust length penalty to encourage longer output
88
- # no_repeat_ngram_size=3, # Avoid repetition of phrases
89
  early_stopping=True
90
  )
91
 
 
62
  except Exception as e:
63
  return f"Error extracting text: {str(e)}"
64
 
65
+ tokenizer_s = AutoTokenizer.from_pretrained("t5-small")
66
+ model_s = AutoModelForSeq2SeqLM.from_pretrained("t5-small")
67
 
68
  def summarize_article(article_text):
69
  """Summarize a given article's text."""
 
82
  # Generate the summary
83
  summary_ids = model_s.generate(
84
  **inputs,
85
+ max_new_tokens=800, # Limit the length of the output
86
  min_length=100, # Set a minimum length for the output
87
  # #length_penalty='1.0', # Adjust length penalty to encourage longer output
88
+ no_repeat_ngram_size=3, # Avoid repetition of phrases
89
  early_stopping=True
90
  )
91