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