Spaces:
Running
Running
Update src/translate/Translate.py (#3)
Browse files- Update src/translate/Translate.py (4ccecd699dd799a2a0989002053969b8011b111f)
src/translate/Translate.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from nltk.tokenize import sent_tokenize
|
| 2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 3 |
import torch
|
|
@@ -8,6 +9,8 @@ from transformers import pipeline
|
|
| 8 |
METHOD = "TRANSLATE"
|
| 9 |
|
| 10 |
def paraphraseTranslateMethod(requestValue: str, model: str):
|
|
|
|
|
|
|
| 11 |
exception = ExceptionCustom.checkForException(requestValue, METHOD)
|
| 12 |
if exception:
|
| 13 |
return "", exception
|
|
|
|
| 1 |
+
import nltk
|
| 2 |
from nltk.tokenize import sent_tokenize
|
| 3 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 4 |
import torch
|
|
|
|
| 9 |
METHOD = "TRANSLATE"
|
| 10 |
|
| 11 |
def paraphraseTranslateMethod(requestValue: str, model: str):
|
| 12 |
+
nltk.download('punkt')
|
| 13 |
+
nltk.download('punkt_tab')
|
| 14 |
exception = ExceptionCustom.checkForException(requestValue, METHOD)
|
| 15 |
if exception:
|
| 16 |
return "", exception
|