alexneakameni commited on
Commit
36caef8
·
verified ·
1 Parent(s): 375cf7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -20,7 +20,7 @@ def predict_language(text, top_k=5):
20
  probs = torch.nn.functional.softmax(logits, dim=-1).squeeze()
21
  top_probs, top_indices = torch.topk(probs, top_k)
22
 
23
- results = [f"{id2label[str(idx.item())]}: {prob:.4f}" for prob, idx in zip(top_probs, top_indices)]
24
  return "\n".join(results)
25
 
26
  # Create Gradio interface
 
20
  probs = torch.nn.functional.softmax(logits, dim=-1).squeeze()
21
  top_probs, top_indices = torch.topk(probs, top_k)
22
 
23
+ results = [f"{id2label[idx.item()]}: {prob:.4f}" for prob, idx in zip(top_probs, top_indices)]
24
  return "\n".join(results)
25
 
26
  # Create Gradio interface