Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -71,36 +71,34 @@ def translation(source, target, text):
|
|
71 |
|
72 |
|
73 |
|
74 |
-
if __name__ == '__main__':
|
75 |
-
print('\tinit models')
|
76 |
|
77 |
-
global model_dict
|
78 |
|
79 |
-
|
|
|
|
|
80 |
|
81 |
# define gradio demo
|
82 |
-
|
83 |
#inputs = [gr.inputs.Radio(['nllb-distilled-600M', 'nllb-1.3B', 'nllb-distilled-1.3B'], label='NLLB Model'),
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
).launch()
|
105 |
|
106 |
|
|
|
71 |
|
72 |
|
73 |
|
|
|
|
|
74 |
|
|
|
75 |
|
76 |
+
global model_dict
|
77 |
+
|
78 |
+
model_dict = load_models()
|
79 |
|
80 |
# define gradio demo
|
81 |
+
lang_codes = list(flores_codes.keys())
|
82 |
#inputs = [gr.inputs.Radio(['nllb-distilled-600M', 'nllb-1.3B', 'nllb-distilled-1.3B'], label='NLLB Model'),
|
83 |
+
|
84 |
+
|
85 |
+
title = "NLLB distilled 1.3B demo"
|
86 |
+
|
87 |
+
demo_status = "Demo is running on CPU"
|
88 |
+
description = f"Details: https://github.com/facebookresearch/fairseq/tree/nllb. {demo_status}"
|
89 |
+
examples = [
|
90 |
+
['English', 'Urdu', 'Hi. nice to meet you']
|
91 |
+
]
|
92 |
+
|
93 |
+
gr.Interface(translation,
|
94 |
+
inputs = [gr.inputs.Dropdown(lang_codes, default='English', label='Source'),
|
95 |
+
gr.inputs.Dropdown(lang_codes, default='Korean', label='Target'),
|
96 |
+
gr.inputs.Textbox(lines=5, label="Input text"),
|
97 |
+
],
|
98 |
+
|
99 |
+
outputs = gr.outputs.JSON(),
|
100 |
+
title=title,
|
101 |
+
description=description,
|
102 |
+
).launch()
|
|
|
103 |
|
104 |
|