Mel Nguyen (she/her) commited on
Commit
48a85a0
1 Parent(s): 4dd2b31

slight mods

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -12,7 +12,7 @@ tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
12
  def load_model(model_name):
13
  model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
14
  return model
15
-
16
  model = load_model("facebook/nllb-200-distilled-600M")
17
 
18
  default_value = "UN Chief says there is no military solution in Syria"
@@ -21,15 +21,14 @@ src_lang_selection = st.radio(
21
  "Select Your Source Language:",
22
  ('English', 'Vietnamese'))
23
 
24
- if src_lang_selection == "English":
25
- src_lang = "eng_Latn"
26
- tgt_lang = "vie_Latn"
27
- else:
28
- src_lang = "vie_Latn"
29
- tgt_lang = "eng_Latn"
30
-
31
  if st.button("Run"):
32
  with st.spinner("Working Hard..."):
 
 
 
 
 
 
33
  translator = pipeline('translation', model=model, tokenizer=tokenizer, src_lang=src_lang, tgt_lang=tgt_lang)
34
  trans_text = translator(sent)[0]["translation_text"]
35
  st.write(trans_text)
 
12
  def load_model(model_name):
13
  model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
14
  return model
15
+
16
  model = load_model("facebook/nllb-200-distilled-600M")
17
 
18
  default_value = "UN Chief says there is no military solution in Syria"
 
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)