Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ else:
|
|
41 |
|
42 |
def translate(text, from_, to_):
|
43 |
# empty line hallucinations fix
|
44 |
-
lines = [f'{line} ' for line text.split('\n')] if text else ''
|
45 |
inputs = tokenizer(lines, return_tensors="pt", padding=True)
|
46 |
inputs['input_ids'][:, 0] = lang2id[LANGS[from_]]
|
47 |
translated_tokens = model.generate(**inputs, max_length=400, forced_bos_token_id=lang2id[LANGS[to_]])
|
|
|
41 |
|
42 |
def translate(text, from_, to_):
|
43 |
# empty line hallucinations fix
|
44 |
+
lines = [f'{line} ' for line in text.split('\n')] if text else ''
|
45 |
inputs = tokenizer(lines, return_tensors="pt", padding=True)
|
46 |
inputs['input_ids'][:, 0] = lang2id[LANGS[from_]]
|
47 |
translated_tokens = model.generate(**inputs, max_length=400, forced_bos_token_id=lang2id[LANGS[to_]])
|