Mel Nguyen (she/her) commited on
Commit
eb1b0b5
1 Parent(s): 48a85a0
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -15,20 +15,20 @@ def load_model(model_name):
15
 
16
  model = load_model("facebook/nllb-200-distilled-600M")
17
 
18
- default_value = "UN Chief says there is no military solution in Syria"
19
- sent = st.text_area("Input Your Text Here", default_value, height = 275)
20
  src_lang_selection = st.radio(
21
  "Select Your Source Language:",
22
  ('English', 'Vietnamese'))
 
 
 
 
 
 
 
 
23
 
24
  if st.button("Run"):
25
  with st.spinner("Working Hard..."):
26
- if src_lang_selection == "English":
27
- src_lang = "eng_Latn"
28
- tgt_lang = "vie_Latn"
29
- else:
30
- src_lang = "vie_Latn"
31
- tgt_lang = "eng_Latn"
32
  translator = pipeline('translation', model=model, tokenizer=tokenizer, src_lang=src_lang, tgt_lang=tgt_lang)
33
  trans_text = translator(sent)[0]["translation_text"]
34
  st.write(trans_text)
 
15
 
16
  model = load_model("facebook/nllb-200-distilled-600M")
17
 
 
 
18
  src_lang_selection = st.radio(
19
  "Select Your Source Language:",
20
  ('English', 'Vietnamese'))
21
+ if src_lang_selection == "English":
22
+ src_lang = "eng_Latn"
23
+ tgt_lang = "vie_Latn"
24
+ else:
25
+ src_lang = "vie_Latn"
26
+ tgt_lang = "eng_Latn"
27
+ default_value = "UN Chief says there is no military solution in Syria"
28
+ sent = st.text_area("Input Your Text Here", default_value, height = 275)
29
 
30
  if st.button("Run"):
31
  with st.spinner("Working Hard..."):
 
 
 
 
 
 
32
  translator = pipeline('translation', model=model, tokenizer=tokenizer, src_lang=src_lang, tgt_lang=tgt_lang)
33
  trans_text = translator(sent)[0]["translation_text"]
34
  st.write(trans_text)