ThapeloAndrewSindane commited on
Commit
f00dc53
1 Parent(s): 8ac851b

Update app.py

Browse files

Adding lid models trained with Vuk data

Files changed (1) hide show
  1. app.py +27 -20
app.py CHANGED
@@ -155,14 +155,21 @@ def load_model_pipeline(model_name, file_name):
155
 
156
 
157
 
158
- model_1 = load_model(constants.MODEL_NAME, "model_v1.bin")
159
- model_2 = load_model(constants.MODEL_NAME, "model_v2.bin")
160
- model_3 = load_model(constants.MODEL_NAME, "model_v3.bin")
161
- openlid = load_model('laurievb/OpenLID', "model.bin")
162
- nllb = load_model('facebook/fasttext-language-identification', "model.bin")
 
 
 
 
 
 
 
 
163
  za_lid = load_model_pipeline('dsfsi/za-lid-bert', "model.bin")
164
 
165
-
166
  # @st.cache_resource
167
  def plot(label, prob):
168
 
@@ -197,16 +204,16 @@ def compute(sentences, version = 'v3'):
197
  """
198
  progress_text = "Computing Language..."
199
 
200
- if version == 'nllb-218':
201
- model_choice = nllb
202
- elif version == 'openlid-201':
203
- model_choice = openlid
204
- elif version == 'v3':
205
- model_choice = model_3
206
- elif version == 'v2':
207
- model_choice = model_2
208
- elif version=='v1':
209
- model_choice = model_1
210
  else:
211
  model_choice = za_lid
212
 
@@ -270,8 +277,8 @@ with tab1:
270
 
271
  version = st.radio(
272
  "Choose model",
273
- ["nllb-218", "openlid-201", "v1", "v2", "v3", "Za_LID"],
274
- captions=["NLLB", "OpenLID", "GlotLID version 1", "GlotLID version 2", "GlotLID version 3 (More languages, better quality data)", "za BERT"],
275
  index = 4,
276
  key = 'version_tab1',
277
  horizontal = True
@@ -309,8 +316,8 @@ with tab2:
309
 
310
  version = st.radio(
311
  "Choose model",
312
- ["nllb-218", "openlid-201", "v1", "v2", "v3", "Za_LID"],
313
- captions=["NLLB", "OpenLID", "GlotLID version 1", "GlotLID version 2 (more data and languages), GlotLID version 3 (More languages, better quality data)", "ZA BERT"],
314
  index = 4,
315
  key = 'version_tab2',
316
  horizontal = True
 
155
 
156
 
157
 
158
+ # model_1 = load_model(constants.MODEL_NAME, "model_v1.bin")
159
+ # model_2 = load_model(constants.MODEL_NAME, "model_v2.bin")
160
+ # model_3 = load_model(constants.MODEL_NAME, "model_v3.bin")
161
+ # openlid = load_model('laurievb/OpenLID', "model.bin")
162
+ # nllb = load_model('facebook/fasttext-language-identification', "model.bin")
163
+
164
+
165
+ # MODELS
166
+ model_xlmr_large = load_model_pipeline('dsfsi/za-xlmrlarge-lid', "model.bin")
167
+ model_serengeti = load_model_pipeline('dsfsi/za-serengeti-lid', "model.bin")
168
+ model_afriberta = load_model_pipeline('dsfsi/za-afriberta-lid', "model.bin")
169
+ model_afroxlmr_base = load_model_pipeline('dsfsi/za-afro-xlmr-base-lid', "model.bin")
170
+ model_afrolm = load_model_pipeline('dsfsi/za-afrolm-lid', "model.bin")
171
  za_lid = load_model_pipeline('dsfsi/za-lid-bert', "model.bin")
172
 
 
173
  # @st.cache_resource
174
  def plot(label, prob):
175
 
 
204
  """
205
  progress_text = "Computing Language..."
206
 
207
+ if version == 'xlmrlarge':
208
+ model_choice = model_xlmr_large
209
+ elif version == 'serengeti':
210
+ model_choice = model_serengeti
211
+ elif version == 'afriberta':
212
+ model_choice = model_afriberta
213
+ elif version == 'afroxlmrbase':
214
+ model_choice = model_afroxlmr_base
215
+ elif version=='afrolm':
216
+ model_choice = model_afrolm
217
  else:
218
  model_choice = za_lid
219
 
 
277
 
278
  version = st.radio(
279
  "Choose model",
280
+ ["xlmrlarge", "serengeti", "afriberta", "afroxlmrbase", "afrolm", "Za_LID"],
281
+ captions=["za-XLMR-Large", "za-Serengeti", "za-AfriBERTa", "za-Afro-XLMR-BASE", "za-AfroLM", "za-BERT"],
282
  index = 4,
283
  key = 'version_tab1',
284
  horizontal = True
 
316
 
317
  version = st.radio(
318
  "Choose model",
319
+ ["xlmrlarge", "serengeti", "afriberta", "afroxlmrbase", "afrolm", "Za_LID"],
320
+ captions=["za-XLMR-Large", "za-Serengeti", "za-AfriBERTa", "za-Afro-XLMR-BASE", "za-AfroLM", "za-BERT"],
321
  index = 4,
322
  key = 'version_tab2',
323
  horizontal = True