rakesh1715 commited on
Commit
758eaaa
·
verified ·
1 Parent(s): e482be2

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -84,8 +84,19 @@ input_data = pd.DataFrame([{
84
 
85
  }])
86
 
87
- if st.button("Predict Tourism Package Taken"):
88
  prediction = model.predict(input_data)[0]
89
- result = "Package Taken" if prediction == 1 else "Package Not Taken"
90
- st.subheader("Prediction Result:")
91
- st.success(f"The model predicts: **{result}**")
 
 
 
 
 
 
 
 
 
 
 
 
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%}**")