Spaces:
Sleeping
Sleeping
app.py
CHANGED
|
@@ -93,6 +93,9 @@ def summarize_text(input_text, model_label, char_limit):
|
|
| 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
|
|
|
|
| 93 |
|
| 94 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 95 |
|
| 96 |
+
# Remove any non-alphanumeric characters except space
|
| 97 |
+
summary = re.sub(r"[^A-Za-z0-9\s]", "", summary)
|
| 98 |
+
|
| 99 |
# Strip unwanted trailing spaces and punctuation
|
| 100 |
summary = summary.strip() # Remove leading and trailing spaces
|
| 101 |
summary = re.sub(r'[^\w\s]$', '', summary) # Remove trailing punctuation
|