Spaces:
Runtime error
Runtime error
ThapeloAndrewSindane
commited on
Commit
•
f00dc53
1
Parent(s):
8ac851b
Update app.py
Browse filesAdding lid models trained with Vuk data
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 == '
|
201 |
-
model_choice =
|
202 |
-
elif version == '
|
203 |
-
model_choice =
|
204 |
-
elif version == '
|
205 |
-
model_choice =
|
206 |
-
elif version == '
|
207 |
-
model_choice =
|
208 |
-
elif version=='
|
209 |
-
model_choice =
|
210 |
else:
|
211 |
model_choice = za_lid
|
212 |
|
@@ -270,8 +277,8 @@ with tab1:
|
|
270 |
|
271 |
version = st.radio(
|
272 |
"Choose model",
|
273 |
-
["
|
274 |
-
captions=["
|
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 |
-
["
|
313 |
-
captions=["
|
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
|