Salavat commited on
Commit
6840864
1 Parent(s): 9f04b6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
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_]])