Spaces:
Running
Running
Update src/translate/Translate.py
Browse files
src/translate/Translate.py
CHANGED
|
@@ -7,6 +7,7 @@ import src.exception.Exception.Exception as ExceptionCustom
|
|
| 7 |
from transformers import pipeline
|
| 8 |
|
| 9 |
METHOD = "TRANSLATE"
|
|
|
|
| 10 |
|
| 11 |
def paraphraseTranslateMethod(requestValue: str, model: str):
|
| 12 |
nltk.download('punkt')
|
|
@@ -17,7 +18,6 @@ def paraphraseTranslateMethod(requestValue: str, model: str):
|
|
| 17 |
|
| 18 |
tokenized_sent_list = sent_tokenize(requestValue)
|
| 19 |
result_value = []
|
| 20 |
-
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 21 |
|
| 22 |
for SENTENCE in tokenized_sent_list:
|
| 23 |
if model == 'roen':
|
|
|
|
| 7 |
from transformers import pipeline
|
| 8 |
|
| 9 |
METHOD = "TRANSLATE"
|
| 10 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 11 |
|
| 12 |
def paraphraseTranslateMethod(requestValue: str, model: str):
|
| 13 |
nltk.download('punkt')
|
|
|
|
| 18 |
|
| 19 |
tokenized_sent_list = sent_tokenize(requestValue)
|
| 20 |
result_value = []
|
|
|
|
| 21 |
|
| 22 |
for SENTENCE in tokenized_sent_list:
|
| 23 |
if model == 'roen':
|