ThapeloAndrewSindane commited on
Commit
e57eb3d
1 Parent(s): a8cf13d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -271,9 +271,8 @@ def compute(sentences, version = 'v3'):
271
  if type(model_choice) == list:
272
  all_models_pred = []
273
  for model in model_choice:
274
- output = model.predict(sent)
275
  if version not in ["openlid-201", "GlotLID v3"]:
276
-
277
  output_label = output[index]['label']
278
  output_prob = output[index]['score']
279
  output_label_language = output[index]['label']
@@ -285,7 +284,7 @@ def compute(sentences, version = 'v3'):
285
  text=progress_text,
286
  )
287
  else:
288
-
289
  output_label = output[0][0].split('__')[-1].replace('_Hans', '_Hani').replace('_Hant', '_Hani')
290
  output_prob = max(min(output[1][0], 1), 0)
291
  output_label_language = output_label.split('_')[0]
@@ -310,8 +309,8 @@ def compute(sentences, version = 'v3'):
310
  )
311
 
312
  else:
313
- output = model_choice.predict(sent)
314
  if version not in ["openlid-201", "GlotLID v3"]:
 
315
  output_label = output[index]['label']
316
  output_prob = output[index]['score']
317
  output_label_language = output[index]['label']
@@ -323,6 +322,7 @@ def compute(sentences, version = 'v3'):
323
  text=progress_text,
324
  )
325
  else:
 
326
  output_label = output[0][0].split('__')[-1].replace('_Hans', '_Hani').replace('_Hant', '_Hani')
327
  output_prob = max(min(output[1][0], 1), 0)
328
  output_label_language = output_label.split('_')[0]
 
271
  if type(model_choice) == list:
272
  all_models_pred = []
273
  for model in model_choice:
 
274
  if version not in ["openlid-201", "GlotLID v3"]:
275
+ output = model.predict(sent)
276
  output_label = output[index]['label']
277
  output_prob = output[index]['score']
278
  output_label_language = output[index]['label']
 
284
  text=progress_text,
285
  )
286
  else:
287
+ output = model.predict(sent)
288
  output_label = output[0][0].split('__')[-1].replace('_Hans', '_Hani').replace('_Hant', '_Hani')
289
  output_prob = max(min(output[1][0], 1), 0)
290
  output_label_language = output_label.split('_')[0]
 
309
  )
310
 
311
  else:
 
312
  if version not in ["openlid-201", "GlotLID v3"]:
313
+ output = model_choice.predict(sent)
314
  output_label = output[index]['label']
315
  output_prob = output[index]['score']
316
  output_label_language = output[index]['label']
 
322
  text=progress_text,
323
  )
324
  else:
325
+ output = model_choice.predict(sent)
326
  output_label = output[0][0].split('__')[-1].replace('_Hans', '_Hani').replace('_Hant', '_Hani')
327
  output_prob = max(min(output[1][0], 1), 0)
328
  output_label_language = output_label.split('_')[0]