Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -32,8 +32,8 @@ def predict(
|
|
| 32 |
customer_address: str,
|
| 33 |
customer_phone: str,
|
| 34 |
customer_email: str,
|
| 35 |
-
weight:
|
| 36 |
-
cod:
|
| 37 |
pickup_address: str,
|
| 38 |
destination_city_name: str):
|
| 39 |
# Convert input data to DataFrame
|
|
@@ -46,8 +46,8 @@ def predict(
|
|
| 46 |
'customer_address': customer_address,
|
| 47 |
'customer_phone_no': customer_phone,
|
| 48 |
'client_email': customer_email,
|
| 49 |
-
'weight':
|
| 50 |
-
'cod':
|
| 51 |
'pickup_address':pickup_address,
|
| 52 |
'destination_branch_name':destination_city_name
|
| 53 |
}
|
|
@@ -65,6 +65,7 @@ def predict(
|
|
| 65 |
# Output
|
| 66 |
predicted_status = "Unknown" if pred[0] == -1 else encoders['status_name'].inverse_transform([pred])[0]
|
| 67 |
probability = pred_proba[0][pred[0]] * 100 if pred[0] != -1 else "Unknown"
|
|
|
|
| 68 |
|
| 69 |
if predicted_status == "Returned to Client":
|
| 70 |
probability = 100 - probability
|
|
|
|
| 32 |
customer_address: str,
|
| 33 |
customer_phone: str,
|
| 34 |
customer_email: str,
|
| 35 |
+
weight: int,
|
| 36 |
+
cod: int,
|
| 37 |
pickup_address: str,
|
| 38 |
destination_city_name: str):
|
| 39 |
# Convert input data to DataFrame
|
|
|
|
| 46 |
'customer_address': customer_address,
|
| 47 |
'customer_phone_no': customer_phone,
|
| 48 |
'client_email': customer_email,
|
| 49 |
+
'weight': weight,
|
| 50 |
+
'cod': cod,
|
| 51 |
'pickup_address':pickup_address,
|
| 52 |
'destination_branch_name':destination_city_name
|
| 53 |
}
|
|
|
|
| 65 |
# Output
|
| 66 |
predicted_status = "Unknown" if pred[0] == -1 else encoders['status_name'].inverse_transform([pred])[0]
|
| 67 |
probability = pred_proba[0][pred[0]] * 100 if pred[0] != -1 else "Unknown"
|
| 68 |
+
print(input_data,predicted_status,probability)
|
| 69 |
|
| 70 |
if predicted_status == "Returned to Client":
|
| 71 |
probability = 100 - probability
|