Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,4 +30,13 @@ target_language = st.selectbox(
|
|
30 |
# Translate button
|
31 |
if st.button("Translate"):
|
32 |
if text:
|
33 |
-
# Load the translation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
# Translate button
|
31 |
if st.button("Translate"):
|
32 |
if text:
|
33 |
+
# Load the translation pipeline based on selected language
|
34 |
+
translation_pipeline = load_translation_pipeline(target_language)
|
35 |
+
if translation_pipeline:
|
36 |
+
# Perform translation
|
37 |
+
translation = translation_pipeline(text)
|
38 |
+
translated_text = translation[0]['translation_text']
|
39 |
+
st.write(f"**Translated text in {target_language}:**")
|
40 |
+
st.write(translated_text)
|
41 |
+
else:
|
42 |
+
st.error("Please enter text to translate.")
|