zaanind commited on
Commit
b78c9fe
·
verified ·
1 Parent(s): 0c6259c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -20,8 +20,9 @@ def translate(text):
20
  prompt = f"<s>[INST] translate this sentence to sinhala - {text} [/INST] sure,here the translation of the provided text - "
21
  input_ids = tokenizer.encode(prompt, return_tensors='pt')
22
  output = model.generate(input_ids, max_length=250, num_return_sequences=1)
23
- for i, generated in enumerate(output):
24
- translation = tokenizer.decode(generated, skip_special_tokens=True)
 
25
  return translation
26
 
27
 
 
20
  prompt = f"<s>[INST] translate this sentence to sinhala - {text} [/INST] sure,here the translation of the provided text - "
21
  input_ids = tokenizer.encode(prompt, return_tensors='pt')
22
  output = model.generate(input_ids, max_length=250, num_return_sequences=1)
23
+ print(output[0])
24
+ translation = tokenizer.decode(output[0], skip_special_tokens=True)
25
+ print(translation)
26
  return translation
27
 
28