Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -640,7 +640,7 @@ def translate(txt,to_lang="en",from_lang=False):
|
|
640 |
if(from_lang == to_lang):
|
641 |
log(f'RET translate with txt as {txt}')
|
642 |
return txt
|
643 |
-
inputs = tokenizer.encode(f"translate {from_lang} to {to_lang}: " +
|
644 |
chunks_length = math.ceil(get_tensor_length(inputs) / 512)
|
645 |
ret = ""
|
646 |
for index in range(chunks_length):
|
|
|
640 |
if(from_lang == to_lang):
|
641 |
log(f'RET translate with txt as {txt}')
|
642 |
return txt
|
643 |
+
inputs = tokenizer.encode(f"translate {from_lang} to {to_lang}: " + txt, return_tensors="pt", max_length=float('inf'), truncation=False)
|
644 |
chunks_length = math.ceil(get_tensor_length(inputs) / 512)
|
645 |
ret = ""
|
646 |
for index in range(chunks_length):
|