Update app.py
Browse files
app.py
CHANGED
@@ -28,13 +28,13 @@ if submit_button:
|
|
28 |
# Encode the input text
|
29 |
# encoded = tokenizer(text_input, return_tensors="pt")
|
30 |
|
31 |
-
input_ids = tokenizer.encode(f'
|
32 |
|
33 |
# Perform translation
|
34 |
output_ids = model.generate(input_ids)
|
35 |
|
36 |
# Decode the translated text
|
37 |
-
translated_text = tokenizer.decode(output_ids, skip_special_tokens=True)
|
38 |
|
39 |
# Display the translated text
|
40 |
st.write("Translated Text:", translated_text)
|
|
|
28 |
# Encode the input text
|
29 |
# encoded = tokenizer(text_input, return_tensors="pt")
|
30 |
|
31 |
+
input_ids = tokenizer.encode(f'translate {sselected_language} to {tselected_language}: {input_text}', return_tensors='pt')
|
32 |
|
33 |
# Perform translation
|
34 |
output_ids = model.generate(input_ids)
|
35 |
|
36 |
# Decode the translated text
|
37 |
+
translated_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
38 |
|
39 |
# Display the translated text
|
40 |
st.write("Translated Text:", translated_text)
|