Spaces:
Running
Running
Commit
Β·
fa81799
1
Parent(s):
be35656
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,11 @@ lang_list = [lang.strip() for lang in langs.split(',')]
|
|
15 |
model = M2M100ForConditionalGeneration.from_pretrained("alirezamsh/small100")
|
16 |
tokenizer = SMALL100Tokenizer.from_pretrained("alirezamsh/small100")
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
tokenizer.tgt_lang = lang
|
20 |
encoded_text = tokenizer(text, return_tensors="pt")
|
21 |
generated_tokens = model.generate(**encoded_text)
|
@@ -23,11 +27,8 @@ def small100_tr(text, lang):
|
|
23 |
|
24 |
examples = [["French (fr)", "μλ§νλ€λ μλΌκ° μλ€."]]
|
25 |
|
26 |
-
demo = gr.Interface(fn=small100_tr, inputs=["text", "text"], outputs="text")
|
27 |
-
demo.launch()
|
28 |
-
|
29 |
output_text = gr.outputs.Textbox()
|
30 |
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",
|
31 |
-
description=
|
32 |
examples=examples
|
33 |
).launch()
|
|
|
15 |
model = M2M100ForConditionalGeneration.from_pretrained("alirezamsh/small100")
|
16 |
tokenizer = SMALL100Tokenizer.from_pretrained("alirezamsh/small100")
|
17 |
|
18 |
+
description = """This is a demo for the paper [*SMaLL-100: Introducing Shallow Multilingual Machine Translation Model for Low-Resource Languages*](https://arxiv.org/abs/2210.11621) by Alireza Mohammadshahi, Vassilina Nikoulina, Alexandre Berard, Caroline Brun, James Henderson, Laurent Besacier
|
19 |
+
|
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)
|
|
|
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",
|
32 |
+
description=description,
|
33 |
examples=examples
|
34 |
).launch()
|