Spaces:
Sleeping
Sleeping
albin
commited on
Commit
·
726cbe5
1
Parent(s):
13e94ee
use proba instead of values for result
Browse files
main.py
CHANGED
|
@@ -126,10 +126,11 @@ 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_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 |
|
| 135 |
# Render index.html with prediction results
|
|
|
|
| 126 |
print("Data sent to predict:", data)
|
| 127 |
print("Data types:", dataFrame_features[selected_columns].dtypes)
|
| 128 |
|
| 129 |
+
prediction_proba = model.predict_proba(data)[:, 1]
|
| 130 |
threshold = 0.1
|
| 131 |
output = 1 if prediction_proba[0][1] >= threshold else 0
|
| 132 |
+
output.astype(int)
|
| 133 |
+
|
| 134 |
output_text = "Legitimate" if output == 1 else "Phishing"
|
| 135 |
|
| 136 |
# Render index.html with prediction results
|