Spaces:
Sleeping
Sleeping
Update src/paraphrase/Paraphrase.py
#4
by
TiberiuCristianLeon
- opened
src/paraphrase/Paraphrase.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from nltk.tokenize import sent_tokenize
|
2 |
from transformers import PegasusForConditionalGeneration, PegasusTokenizer
|
3 |
import torch
|
@@ -6,6 +7,8 @@ import src.exception.Exception.Exception as ExceptionCustom
|
|
6 |
METHOD = "PARAPHRASE"
|
7 |
|
8 |
def paraphraseParaphraseMethod(requestValue : str, model: str = 'tuner007/pegasus_paraphrase'):
|
|
|
|
|
9 |
exception = ""
|
10 |
result_value = ""
|
11 |
tokenizer = PegasusTokenizer.from_pretrained(model)
|
|
|
1 |
+
import nltk
|
2 |
from nltk.tokenize import sent_tokenize
|
3 |
from transformers import PegasusForConditionalGeneration, PegasusTokenizer
|
4 |
import torch
|
|
|
7 |
METHOD = "PARAPHRASE"
|
8 |
|
9 |
def paraphraseParaphraseMethod(requestValue : str, model: str = 'tuner007/pegasus_paraphrase'):
|
10 |
+
nltk.download('punkt')
|
11 |
+
nltk.download('punkt_tab')
|
12 |
exception = ""
|
13 |
result_value = ""
|
14 |
tokenizer = PegasusTokenizer.from_pretrained(model)
|