Spaces:
Sleeping
Sleeping
app.py
CHANGED
@@ -92,6 +92,11 @@ def summarize_text(input_text, model_label, char_limit):
|
|
92 |
|
93 |
|
94 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
|
|
|
|
|
|
|
|
|
|
95 |
return summary[:char_limit].strip()
|
96 |
|
97 |
# Gradio UI
|
|
|
92 |
|
93 |
|
94 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
95 |
+
|
96 |
+
# Strip unwanted trailing spaces and punctuation
|
97 |
+
summary = summary.strip() # Remove leading and trailing spaces
|
98 |
+
summary = re.sub(r'[^\w\s]$', '', summary) # Remove trailing punctuation
|
99 |
+
|
100 |
return summary[:char_limit].strip()
|
101 |
|
102 |
# Gradio UI
|