futranbg commited on
Commit
d5f2c23
Β·
1 Parent(s): f6fdb99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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
- result = model.predict(input, k=5)
10
- return result
 
 
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()