Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ model = T5ForConditionalGeneration.from_pretrained(model_name)
|
|
9 |
|
10 |
# Create the app layout
|
11 |
st.title("Text Translation App")
|
12 |
-
input_text = st.text_input("Enter text to translate:")
|
13 |
submit_button = st.button("Translate")
|
14 |
translated_text = st.text("")
|
15 |
|
@@ -17,7 +17,8 @@ translated_text = st.text("")
|
|
17 |
if submit_button:
|
18 |
# Encode the input text
|
19 |
# encoded = tokenizer(text_input, return_tensors="pt")
|
20 |
-
|
|
|
21 |
|
22 |
# Perform translation
|
23 |
output_ids = model.generate(input_ids)
|
|
|
9 |
|
10 |
# Create the app layout
|
11 |
st.title("Text Translation App")
|
12 |
+
input_text = st.text_input("Enter text to translate ENDE:")
|
13 |
submit_button = st.button("Translate")
|
14 |
translated_text = st.text("")
|
15 |
|
|
|
17 |
if submit_button:
|
18 |
# Encode the input text
|
19 |
# encoded = tokenizer(text_input, return_tensors="pt")
|
20 |
+
|
21 |
+
input_ids = tokenizer.encode(f'Translate English to German: {input_text}', return_tensors='pt')
|
22 |
|
23 |
# Perform translation
|
24 |
output_ids = model.generate(input_ids)
|