Spaces:
Sleeping
Sleeping
Gabriela Nicole Gonzalez Saez
commited on
Commit
·
321366c
1
Parent(s):
6ed6448
en-sw
Browse files
app.py
CHANGED
@@ -21,10 +21,13 @@ from functools import partial
|
|
21 |
model_es = "Helsinki-NLP/opus-mt-en-es"
|
22 |
model_fr = "Helsinki-NLP/opus-mt-en-fr"
|
23 |
model_zh = "Helsinki-NLP/opus-mt-en-zh"
|
|
|
|
|
24 |
|
25 |
model_es = inseq.load_model("Helsinki-NLP/opus-mt-en-es", "input_x_gradient")
|
26 |
model_fr = inseq.load_model("Helsinki-NLP/opus-mt-en-fr", "input_x_gradient")
|
27 |
model_zh = inseq.load_model("Helsinki-NLP/opus-mt-en-zh", "input_x_gradient")
|
|
|
28 |
|
29 |
|
30 |
def saliency_contrastive(input, ref, cont, inseq_model):
|
@@ -89,7 +92,7 @@ dict_models = {
|
|
89 |
'en-zh': model_zh,
|
90 |
'en-fr': model_fr,
|
91 |
'en-es': model_es,
|
92 |
-
|
93 |
}
|
94 |
|
95 |
saliency_examples = [
|
@@ -144,7 +147,7 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
144 |
gr.Examples(contrastive_examples,[text_input_c, text_input_ref, text_input_cont])
|
145 |
text_output_c = gr.HTML()
|
146 |
|
147 |
-
radio_c = gr.Radio(choices=['en-zh', 'en-es', 'en-fr'], value="en-fr", label= '', container=False)
|
148 |
text_button_c = gr.Button("Translate")
|
149 |
|
150 |
text_button.click(fn=saliency_inseq, inputs=[text_input, radio], outputs=[text_output, text_output_box])
|
|
|
21 |
model_es = "Helsinki-NLP/opus-mt-en-es"
|
22 |
model_fr = "Helsinki-NLP/opus-mt-en-fr"
|
23 |
model_zh = "Helsinki-NLP/opus-mt-en-zh"
|
24 |
+
model_sw = "Helsinki-NLP/opus-mt-en-sw"
|
25 |
+
|
26 |
|
27 |
model_es = inseq.load_model("Helsinki-NLP/opus-mt-en-es", "input_x_gradient")
|
28 |
model_fr = inseq.load_model("Helsinki-NLP/opus-mt-en-fr", "input_x_gradient")
|
29 |
model_zh = inseq.load_model("Helsinki-NLP/opus-mt-en-zh", "input_x_gradient")
|
30 |
+
model_sw = inseq.load_model("Helsinki-NLP/opus-mt-en-sw", "input_x_gradient")
|
31 |
|
32 |
|
33 |
def saliency_contrastive(input, ref, cont, inseq_model):
|
|
|
92 |
'en-zh': model_zh,
|
93 |
'en-fr': model_fr,
|
94 |
'en-es': model_es,
|
95 |
+
'en-sw': model_sw
|
96 |
}
|
97 |
|
98 |
saliency_examples = [
|
|
|
147 |
gr.Examples(contrastive_examples,[text_input_c, text_input_ref, text_input_cont])
|
148 |
text_output_c = gr.HTML()
|
149 |
|
150 |
+
radio_c = gr.Radio(choices=['en-zh', 'en-es', 'en-fr', 'en-sw'], value="en-fr", label= '', container=False)
|
151 |
text_button_c = gr.Button("Translate")
|
152 |
|
153 |
text_button.click(fn=saliency_inseq, inputs=[text_input, radio], outputs=[text_output, text_output_box])
|