Update app.py
Browse files
app.py
CHANGED
@@ -25,16 +25,10 @@ translated_textarea = st.text("")
|
|
25 |
|
26 |
# Handle the submit button click
|
27 |
if submit_button:
|
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)
|
|
|
25 |
|
26 |
# Handle the submit button click
|
27 |
if submit_button:
|
|
|
|
|
|
|
28 |
input_ids = tokenizer.encode(f'translate {sselected_language} to {tselected_language}: {input_text}', return_tensors='pt')
|
|
|
29 |
# Perform translation
|
30 |
output_ids = model.generate(input_ids)
|
|
|
31 |
# Decode the translated text
|
32 |
translated_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
|
|
33 |
# Display the translated text
|
34 |
+
st.write(f"Translated Text from {sselected_language}:", translated_text)
|