alirezamsh commited on
Commit
d326433
β€’
1 Parent(s): fa81799

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -20,12 +20,15 @@ description = """This is a demo for the paper [*SMaLL-100: Introducing Shallow M
20
  In this paper, they propose a compact and shallow massively multilingual MT model, and achieve competitive result with M2M-100, while being super smaller and faster."""
21
 
22
  def small100_tr(lang, text):
 
 
 
23
  tokenizer.tgt_lang = lang
24
  encoded_text = tokenizer(text, return_tensors="pt")
25
  generated_tokens = model.generate(**encoded_text)
26
  return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
27
 
28
- examples = [["French (fr)", "μ—„λ§ˆνŒλ‹€λŠ” μƒˆλΌκ°€ μžˆλ„€."]]
29
 
30
  output_text = gr.outputs.Textbox()
31
  gr.Interface(small100_tr, inputs=[gr.inputs.Dropdown(lang_list, label=" Target Language"), 'text'], outputs=output_text, title="SMaLL100: Translate Between 100 languages much faster",
 
20
  In this paper, they propose a compact and shallow massively multilingual MT model, and achieve competitive result with M2M-100, while being super smaller and faster."""
21
 
22
  def small100_tr(lang, text):
23
+
24
+ lang = lang.split(" ")[-1][1:-1]
25
+
26
  tokenizer.tgt_lang = lang
27
  encoded_text = tokenizer(text, return_tensors="pt")
28
  generated_tokens = model.generate(**encoded_text)
29
  return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
30
 
31
+ examples = [["French (fr)", "Life is like a box of chocolates."]]
32
 
33
  output_text = gr.outputs.Textbox()
34
  gr.Interface(small100_tr, inputs=[gr.inputs.Dropdown(lang_list, label=" Target Language"), 'text'], outputs=output_text, title="SMaLL100: Translate Between 100 languages much faster",