saima730 commited on
Commit
15aed8d
·
verified ·
1 Parent(s): 539e001

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
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 pipe
 
 
 
 
 
 
 
 
 
 
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.")