Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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("
|
66 |
-
model_s = AutoModelForSeq2SeqLM.from_pretrained("
|
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=
|
86 |
min_length=100, # Set a minimum length for the output
|
87 |
# #length_penalty='1.0', # Adjust length penalty to encourage longer output
|
88 |
-
|
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 |
|