samdo20 commited on
Commit
b2c3872
·
verified ·
1 Parent(s): 151cf1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -1,3 +1,16 @@
1
  import gradio as gr
2
  import fasttext
3
- from huggingface_hub import hf_hub_download
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()