syeda-Rija20 commited on
Commit
397fc97
·
verified ·
1 Parent(s): abdf651

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -76,6 +76,8 @@ def predict_news(text, tokenizer, text_model):
76
  with torch.no_grad():
77
  outputs = text_model(**inputs)
78
  probs = torch.nn.functional.softmax(outputs.logits, dim=1)
 
 
79
  prediction = torch.argmax(probs).item()
80
  confidence = torch.max(probs).item() * 100
81
  return prediction, confidence
 
76
  with torch.no_grad():
77
  outputs = text_model(**inputs)
78
  probs = torch.nn.functional.softmax(outputs.logits, dim=1)
79
+ # ADD THIS to see raw scores
80
+ st.write(f"Debug → Label 0 score: {probs[0][0]:.2f}, Label 1 score: {probs[0][1]:.2f}")
81
  prediction = torch.argmax(probs).item()
82
  confidence = torch.max(probs).item() * 100
83
  return prediction, confidence