Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -7,14 +7,18 @@ import joblib
|
|
| 7 |
model_path = hf_hub_download(repo_id="Rajanan/model-visit-with-us-mlops", filename="best_model_v1.joblib")
|
| 8 |
model = joblib.load(model_path)
|
| 9 |
|
| 10 |
-
# Streamlit
|
|
|
|
|
|
|
| 11 |
st.title("Tourism Package Prediction App")
|
| 12 |
st.write("""
|
| 13 |
This application predicts the likelihood of a Tourism Product Taken based on its operational parameters.
|
| 14 |
Please enter the specifiction data below to get a prediction.
|
| 15 |
""")
|
| 16 |
|
| 17 |
-
#
|
|
|
|
|
|
|
| 18 |
age = st.number_input("Age", min_value=18, max_value=61, value=37)
|
| 19 |
type_of_contact = st.selectbox("Type of Contact", ["Self Enquiry", "Company Invited"])
|
| 20 |
city_tier = st.selectbox("City Tier", [1, 2, 3])
|
|
@@ -34,7 +38,9 @@ num_children_visiting = st.selectbox("Number of Children Visiting", [0, 1, 2,3])
|
|
| 34 |
designation = st.selectbox("Designation", ["Executive", "Manager", "Senior Manager", "AVP", "VP"])
|
| 35 |
monthly_income = st.number_input("Monthly Income (₹)", min_value=1000, max_value=98678, value=22000, step=1000)
|
| 36 |
|
| 37 |
-
# Assemble
|
|
|
|
|
|
|
| 38 |
input_data = pd.DataFrame([{
|
| 39 |
'Age': age,
|
| 40 |
'TypeofContact': type_of_contact,
|
|
@@ -56,6 +62,9 @@ input_data = pd.DataFrame([{
|
|
| 56 |
'MonthlyIncome': monthly_income
|
| 57 |
}])
|
| 58 |
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
if st.button("Predict Product "):
|
| 61 |
prediction = model.predict(input_data)[0]
|
|
|
|
| 7 |
model_path = hf_hub_download(repo_id="Rajanan/model-visit-with-us-mlops", filename="best_model_v1.joblib")
|
| 8 |
model = joblib.load(model_path)
|
| 9 |
|
| 10 |
+
# Streamlit application for predicting customer purchase
|
| 11 |
+
# of the Wellness Tourism Package.
|
| 12 |
+
|
| 13 |
st.title("Tourism Package Prediction App")
|
| 14 |
st.write("""
|
| 15 |
This application predicts the likelihood of a Tourism Product Taken based on its operational parameters.
|
| 16 |
Please enter the specifiction data below to get a prediction.
|
| 17 |
""")
|
| 18 |
|
| 19 |
+
# Collect user inputs.
|
| 20 |
+
# Input features and value ranges are aligned with the training dataset.
|
| 21 |
+
|
| 22 |
age = st.number_input("Age", min_value=18, max_value=61, value=37)
|
| 23 |
type_of_contact = st.selectbox("Type of Contact", ["Self Enquiry", "Company Invited"])
|
| 24 |
city_tier = st.selectbox("City Tier", [1, 2, 3])
|
|
|
|
| 38 |
designation = st.selectbox("Designation", ["Executive", "Manager", "Senior Manager", "AVP", "VP"])
|
| 39 |
monthly_income = st.number_input("Monthly Income (₹)", min_value=1000, max_value=98678, value=22000, step=1000)
|
| 40 |
|
| 41 |
+
# Assemble user inputs into a DataFrame that matches
|
| 42 |
+
# the feature schema used during model training.
|
| 43 |
+
|
| 44 |
input_data = pd.DataFrame([{
|
| 45 |
'Age': age,
|
| 46 |
'TypeofContact': type_of_contact,
|
|
|
|
| 62 |
'MonthlyIncome': monthly_income
|
| 63 |
}])
|
| 64 |
|
| 65 |
+
# Trigger prediction using the trained model pipeline.
|
| 66 |
+
# The model outputs a binary classification:
|
| 67 |
+
# 1 → Product Taken, 0 → Product Not Taken.
|
| 68 |
|
| 69 |
if st.button("Predict Product "):
|
| 70 |
prediction = model.predict(input_data)[0]
|