Spaces:
Running
Running
Update src/translate/Translate.py
Browse files
src/translate/Translate.py
CHANGED
|
@@ -22,7 +22,6 @@ def paraphraseTranslateMethod(requestValue : str, model: str):
|
|
| 22 |
exception = ""
|
| 23 |
result_value = ""
|
| 24 |
|
| 25 |
-
|
| 26 |
exception = ExceptionCustom.checkForException(requestValue, METHOD)
|
| 27 |
if exception != "":
|
| 28 |
return "", exception
|
|
@@ -30,7 +29,7 @@ def paraphraseTranslateMethod(requestValue : str, model: str):
|
|
| 30 |
tokenized_sent_list = sent_tokenize(requestValue)
|
| 31 |
|
| 32 |
for SENTENCE in tokenized_sent_list:
|
| 33 |
-
if model == 'roen'
|
| 34 |
input_ids = tokenizerROMENG(SENTENCE, return_tensors='pt').to(device)
|
| 35 |
output = modelROMENG.generate(
|
| 36 |
input_ids=input_ids1.input_ids,
|
|
@@ -53,4 +52,4 @@ def paraphraseTranslateMethod(requestValue : str, model: str):
|
|
| 53 |
early_stopping=False
|
| 54 |
)
|
| 55 |
result = tokenizerENGROM.batch_decode(output, skip_special_tokens=True)[0]
|
| 56 |
-
return result.strip(),
|
|
|
|
| 22 |
exception = ""
|
| 23 |
result_value = ""
|
| 24 |
|
|
|
|
| 25 |
exception = ExceptionCustom.checkForException(requestValue, METHOD)
|
| 26 |
if exception != "":
|
| 27 |
return "", exception
|
|
|
|
| 29 |
tokenized_sent_list = sent_tokenize(requestValue)
|
| 30 |
|
| 31 |
for SENTENCE in tokenized_sent_list:
|
| 32 |
+
if model == 'roen':
|
| 33 |
input_ids = tokenizerROMENG(SENTENCE, return_tensors='pt').to(device)
|
| 34 |
output = modelROMENG.generate(
|
| 35 |
input_ids=input_ids1.input_ids,
|
|
|
|
| 52 |
early_stopping=False
|
| 53 |
)
|
| 54 |
result = tokenizerENGROM.batch_decode(output, skip_special_tokens=True)[0]
|
| 55 |
+
return result.strip(), model
|