Spaces:
Runtime error
Runtime error
Commit
•
1aa7403
1
Parent(s):
3df03f3
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,8 @@ from flores200_codes import flores_codes
|
|
8 |
|
9 |
def load_models():
|
10 |
# build model and tokenizer
|
11 |
-
model_name_dict = {'nllb-
|
|
|
12 |
#'nllb-1.3B': 'facebook/nllb-200-1.3B',
|
13 |
#'nllb-distilled-1.3B': 'facebook/nllb-200-distilled-1.3B',
|
14 |
#'nllb-3.3B': 'facebook/nllb-200-3.3B',
|
@@ -28,7 +29,8 @@ def load_models():
|
|
28 |
|
29 |
def translation(source, target, text):
|
30 |
if len(model_dict) == 2:
|
31 |
-
model_name = 'nllb-distilled-600M'
|
|
|
32 |
|
33 |
start_time = time.time()
|
34 |
source = flores_codes[source]
|
@@ -61,18 +63,18 @@ if __name__ == '__main__':
|
|
61 |
lang_codes = list(flores_codes.keys())
|
62 |
#inputs = [gr.inputs.Radio(['nllb-distilled-600M', 'nllb-1.3B', 'nllb-distilled-1.3B'], label='NLLB Model'),
|
63 |
inputs = [gr.inputs.Dropdown(lang_codes, default='English', label='Source'),
|
64 |
-
gr.inputs.Dropdown(lang_codes, default='
|
65 |
gr.inputs.Textbox(lines=5, label="Input text"),
|
66 |
]
|
67 |
|
68 |
outputs = gr.outputs.JSON()
|
69 |
|
70 |
-
title = "NLLB
|
71 |
|
72 |
demo_status = "Demo is running on CPU"
|
73 |
description = f"Details: https://github.com/facebookresearch/fairseq/tree/nllb. {demo_status}"
|
74 |
examples = [
|
75 |
-
['English', '
|
76 |
]
|
77 |
|
78 |
gr.Interface(translation,
|
|
|
8 |
|
9 |
def load_models():
|
10 |
# build model and tokenizer
|
11 |
+
model_name_dict = { 'nllb-3.3B': 'facebook/nllb-200-3.3B',
|
12 |
+
#'nllb-distilled-600M': 'facebook/nllb-200-distilled-600M',
|
13 |
#'nllb-1.3B': 'facebook/nllb-200-1.3B',
|
14 |
#'nllb-distilled-1.3B': 'facebook/nllb-200-distilled-1.3B',
|
15 |
#'nllb-3.3B': 'facebook/nllb-200-3.3B',
|
|
|
29 |
|
30 |
def translation(source, target, text):
|
31 |
if len(model_dict) == 2:
|
32 |
+
# model_name = 'nllb-distilled-600M'
|
33 |
+
model_name = 'nllb-3.3B'
|
34 |
|
35 |
start_time = time.time()
|
36 |
source = flores_codes[source]
|
|
|
63 |
lang_codes = list(flores_codes.keys())
|
64 |
#inputs = [gr.inputs.Radio(['nllb-distilled-600M', 'nllb-1.3B', 'nllb-distilled-1.3B'], label='NLLB Model'),
|
65 |
inputs = [gr.inputs.Dropdown(lang_codes, default='English', label='Source'),
|
66 |
+
gr.inputs.Dropdown(lang_codes, default='Shan', label='Target'),
|
67 |
gr.inputs.Textbox(lines=5, label="Input text"),
|
68 |
]
|
69 |
|
70 |
outputs = gr.outputs.JSON()
|
71 |
|
72 |
+
title = "NLLB Translation demo"
|
73 |
|
74 |
demo_status = "Demo is running on CPU"
|
75 |
description = f"Details: https://github.com/facebookresearch/fairseq/tree/nllb. {demo_status}"
|
76 |
examples = [
|
77 |
+
['English', 'Shan', 'Hi. nice to meet you']
|
78 |
]
|
79 |
|
80 |
gr.Interface(translation,
|