Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -84,8 +84,19 @@ input_data = pd.DataFrame([{
|
|
| 84 |
|
| 85 |
}])
|
| 86 |
|
| 87 |
-
if st.button("Predict
|
| 88 |
prediction = model.predict(input_data)[0]
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
}])
|
| 86 |
|
| 87 |
+
if st.button("Predict"):
|
| 88 |
prediction = model.predict(input_data)[0]
|
| 89 |
+
probability = None
|
| 90 |
+
try:
|
| 91 |
+
proba = model.predict_proba(input_data)[0, 1]
|
| 92 |
+
except Exception as err:
|
| 93 |
+
st.error("Error in checking the probability of purchase")
|
| 94 |
+
|
| 95 |
+
st.subheader("Prediction Result")
|
| 96 |
+
if prediction == 1:
|
| 97 |
+
st.success("The model predicts that the customer is **LIKELY** to purchase the package.")
|
| 98 |
+
else:
|
| 99 |
+
st.info("The model predicts that the customer is **UNLIKELY** to purchase the package.")
|
| 100 |
+
|
| 101 |
+
if probability is not None:
|
| 102 |
+
st.write(f"Estimated probability of purchase: **{probability:.2%}**")
|