Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
import fasttext
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import fasttext
|
3 |
+
|
4 |
+
# Charger le modèle de FastText pour l'identification des langues
|
5 |
+
model = fasttext.load_model("lid.176.bin") # Assure-toi que ce modèle est téléchargé ou accessible
|
6 |
+
|
7 |
+
# Fonction de prédiction de la langue
|
8 |
+
def predict_language(text):
|
9 |
+
prediction = model.predict(text)
|
10 |
+
return prediction[0][0] # Retourne la langue prédite
|
11 |
+
|
12 |
+
# Interface Gradio
|
13 |
+
iface = gr.Interface(fn=predict_language, inputs="text", outputs="text", live=True)
|
14 |
+
|
15 |
+
if __name__ == "__main__":
|
16 |
+
iface.launch()
|