Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,8 +6,10 @@ model_path = hf_hub_download(repo_id="facebook/fasttext-language-identification"
|
|
| 6 |
model = fasttext.load_model(model_path)
|
| 7 |
|
| 8 |
def classify(input):
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
| 12 |
iface = gr.Interface(fn=classify, inputs="text", outputs="label")
|
| 13 |
iface.launch()
|
|
|
|
| 6 |
model = fasttext.load_model(model_path)
|
| 7 |
|
| 8 |
def classify(input):
|
| 9 |
+
labels,values = model.predict(input, k=5)
|
| 10 |
+
paired = zip(labels, values)
|
| 11 |
+
label_dict = dict(paired)
|
| 12 |
+
return label_dict
|
| 13 |
|
| 14 |
iface = gr.Interface(fn=classify, inputs="text", outputs="label")
|
| 15 |
iface.launch()
|