Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -725,7 +725,7 @@ def translate(txt,to_lang="en",from_lang=False):
|
|
725 |
for index in range(math.ceil( len(words) / 512 )):
|
726 |
chunk = " ".join(words[ index*512:(index+1)*512 ])
|
727 |
inputs = tokenizer.encode(prefix+chunk, return_tensors="pt", max_length=float('inf'), truncation=False)
|
728 |
-
gen = model.generate(
|
729 |
toks = tokenizer.decode(gen[0], skip_special_tokens=True)
|
730 |
ret = ret + ("" if ret == "" else " ") + toks
|
731 |
log(f'RET translate with ret as {ret}')
|
|
|
725 |
for index in range(math.ceil( len(words) / 512 )):
|
726 |
chunk = " ".join(words[ index*512:(index+1)*512 ])
|
727 |
inputs = tokenizer.encode(prefix+chunk, return_tensors="pt", max_length=float('inf'), truncation=False)
|
728 |
+
gen = model.generate(inputs)
|
729 |
toks = tokenizer.decode(gen[0], skip_special_tokens=True)
|
730 |
ret = ret + ("" if ret == "" else " ") + toks
|
731 |
log(f'RET translate with ret as {ret}')
|