Demosthene-OR
commited on
Commit
•
2b50631
1
Parent(s):
533f39c
Update main_dl.py
Browse files- main_dl.py +4 -4
main_dl.py
CHANGED
@@ -246,7 +246,7 @@ rnn_en_fr, rnn_fr_en = load_rnn()
|
|
246 |
transformer_en_fr, transformer_fr_en = load_transformer()
|
247 |
|
248 |
# ==== Language identifier ====
|
249 |
-
|
250 |
def encode_text(textes):
|
251 |
global tokenizer
|
252 |
|
@@ -278,9 +278,9 @@ def init_dl_identifier():
|
|
278 |
if (dl_model is not None): print("dl_model OK")
|
279 |
else: print("dl_model vide")
|
280 |
return
|
281 |
-
|
282 |
init_dl_identifier()
|
283 |
-
|
284 |
def lang_id_dl(sentences):
|
285 |
global dl_model, label_encoder, lan_to_language
|
286 |
|
@@ -293,7 +293,7 @@ def lang_id_dl(sentences):
|
|
293 |
predicted_languages = label_encoder.classes_[predicted_labels_encoded]
|
294 |
if "str" in str(type(sentences)): return lan_to_language[predicted_languages[0]]
|
295 |
else: return [l for l in predicted_languages]
|
296 |
-
|
297 |
# ==== Endpoints ====
|
298 |
|
299 |
@api.get('/', name="Vérification que l'API fonctionne")
|
|
|
246 |
transformer_en_fr, transformer_fr_en = load_transformer()
|
247 |
|
248 |
# ==== Language identifier ====
|
249 |
+
|
250 |
def encode_text(textes):
|
251 |
global tokenizer
|
252 |
|
|
|
278 |
if (dl_model is not None): print("dl_model OK")
|
279 |
else: print("dl_model vide")
|
280 |
return
|
281 |
+
'''
|
282 |
init_dl_identifier()
|
283 |
+
'''
|
284 |
def lang_id_dl(sentences):
|
285 |
global dl_model, label_encoder, lan_to_language
|
286 |
|
|
|
293 |
predicted_languages = label_encoder.classes_[predicted_labels_encoded]
|
294 |
if "str" in str(type(sentences)): return lan_to_language[predicted_languages[0]]
|
295 |
else: return [l for l in predicted_languages]
|
296 |
+
|
297 |
# ==== Endpoints ====
|
298 |
|
299 |
@api.get('/', name="Vérification que l'API fonctionne")
|