Update app.py
Browse files
app.py
CHANGED
@@ -67,11 +67,11 @@ if submit_button:
|
|
67 |
messages = [
|
68 |
{"role": "user", "content": f"Translate the following text from {sselected_language} into {tselected_language}.\n{sselected_language}: {input_text}.\n{tselected_language}:"},
|
69 |
]
|
70 |
-
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=
|
71 |
outputs = pipe(prompt, max_new_tokens=256, do_sample=False)
|
72 |
translated_text = outputs[0]["generated_text"]
|
73 |
|
74 |
# Display the translated text
|
75 |
print(translated_text)
|
76 |
-
st.write(f"Translated text from {sselected_language} to {tselected_language} using {model_name}")
|
77 |
translated_textarea = st.text(translated_text)
|
|
|
67 |
messages = [
|
68 |
{"role": "user", "content": f"Translate the following text from {sselected_language} into {tselected_language}.\n{sselected_language}: {input_text}.\n{tselected_language}:"},
|
69 |
]
|
70 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=False)
|
71 |
outputs = pipe(prompt, max_new_tokens=256, do_sample=False)
|
72 |
translated_text = outputs[0]["generated_text"]
|
73 |
|
74 |
# Display the translated text
|
75 |
print(translated_text)
|
76 |
+
st.write(f"Translated text from {sselected_language} to {tselected_language} using {model_name}:")
|
77 |
translated_textarea = st.text(translated_text)
|