Update app.py
Browse files
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 |
-
|
| 24 |
-
|
|
|
|
| 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 |
|