Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
-
|
| 4 |
|
| 5 |
from transformers import AutoTokenizer
|
| 6 |
from transformers import AutoModelForSeq2SeqLM
|
|
@@ -21,7 +21,7 @@ model = AutoModelForSeq2SeqLM.from_pretrained("kriton/greek-text-summarization")
|
|
| 21 |
|
| 22 |
#remove incomplete sentences from the output
|
| 23 |
def remove_incomplete_sentence(text):
|
| 24 |
-
match = re.search(r'(.+?[
|
| 25 |
|
| 26 |
if match:
|
| 27 |
return match.group(1)[::-1].strip()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
+
import re
|
| 4 |
|
| 5 |
from transformers import AutoTokenizer
|
| 6 |
from transformers import AutoModelForSeq2SeqLM
|
|
|
|
| 21 |
|
| 22 |
#remove incomplete sentences from the output
|
| 23 |
def remove_incomplete_sentence(text):
|
| 24 |
+
match = re.search(r'(.+?[.!?;])(?:\s|$)', text[::-1])
|
| 25 |
|
| 26 |
if match:
|
| 27 |
return match.group(1)[::-1].strip()
|