Hunzla commited on
Commit
599665c
1 Parent(s): e8daf1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -26
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
- model_dict = load_models()
 
 
80
 
81
  # define gradio demo
82
- lang_codes = list(flores_codes.keys())
83
  #inputs = [gr.inputs.Radio(['nllb-distilled-600M', 'nllb-1.3B', 'nllb-distilled-1.3B'], label='NLLB Model'),
84
- inputs = [gr.inputs.Dropdown(lang_codes, default='English', label='Source'),
85
- gr.inputs.Dropdown(lang_codes, default='Korean', label='Target'),
86
- gr.inputs.Textbox(lines=5, label="Input text"),
87
- ]
88
-
89
- outputs = gr.outputs.JSON()
90
-
91
- title = "NLLB distilled 1.3B demo"
92
-
93
- demo_status = "Demo is running on CPU"
94
- description = f"Details: https://github.com/facebookresearch/fairseq/tree/nllb. {demo_status}"
95
- examples = [
96
- ['English', 'Urdu', 'Hi. nice to meet you']
97
- ]
98
-
99
- gr.Interface(translation,
100
- inputs=[gr.Textbox(title="source"),gr.Textbox(title="target"),gr.Textbox(title="text")],
101
- outputs=gr.Textbox(),
102
- title=title,
103
- description=description,
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