albin commited on
Commit
13e94ee
·
1 Parent(s): 8b6f142

use proba instead of values for result

Browse files
Files changed (1) hide show
  1. main.py +3 -2
main.py CHANGED
@@ -126,8 +126,9 @@ async def predict(request: Request, requess: Req = Depends(form_req)):
126
  print("Data sent to predict:", data)
127
  print("Data types:", dataFrame_features[selected_columns].dtypes)
128
 
129
- prediction = model.predict(data)
130
- output = prediction[0]
 
131
 
132
  output_text = "Legitimate" if output == 1 else "Phishing"
133
 
 
126
  print("Data sent to predict:", data)
127
  print("Data types:", dataFrame_features[selected_columns].dtypes)
128
 
129
+ prediction_proba = model.predict_proba(data)
130
+ threshold = 0.1
131
+ output = 1 if prediction_proba[0][1] >= threshold else 0
132
 
133
  output_text = "Legitimate" if output == 1 else "Phishing"
134