FikriRiyadi commited on
Commit
dc14b12
·
verified ·
1 Parent(s): 22c8df9

Update predict_utils.py

Browse files
Files changed (1) hide show
  1. predict_utils.py +3 -2
predict_utils.py CHANGED
@@ -24,6 +24,7 @@ def predict(text, model, tokenizer):
24
  with torch.no_grad():
25
  outputs = model(input_ids, attention_mask)
26
  probs = outputs.cpu().numpy()[0]
27
- result = {label: (f"✅ Ya ({prob:.2f})" if prob >= thr else f"❌ Tidak ({prob:.2f})")
28
- for label, prob, thr in zip(LABELS, probs, THRESHOLDS)}
 
29
  return result
 
24
  with torch.no_grad():
25
  outputs = model(input_ids, attention_mask)
26
  probs = outputs.cpu().numpy()[0]
27
+
28
+ # Buat dictionary {label: prob} untuk Gradio Label with confidence
29
+ result = {label: float(prob) for label, prob in zip(LABELS, probs)}
30
  return result