Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +18 -3
src/streamlit_app.py
CHANGED
|
@@ -34,6 +34,7 @@ st.markdown("Predict if a customer will purchase the Wellness Tourism Package")
|
|
| 34 |
with st.form("customer_form"):
|
| 35 |
col1, col2 = st.columns(2)
|
| 36 |
|
|
|
|
| 37 |
with col1:
|
| 38 |
age = st.number_input("Age", min_value=18, max_value=80, value=35)
|
| 39 |
gender = st.selectbox("Gender", ["Male", "Female"])
|
|
@@ -43,7 +44,11 @@ with st.form("customer_form"):
|
|
| 43 |
occupation = st.selectbox(
|
| 44 |
"Occupation", ["Salaried", "Employee", "Freelancer", "Small Business"]
|
| 45 |
)
|
|
|
|
|
|
|
|
|
|
| 46 |
|
|
|
|
| 47 |
with col2:
|
| 48 |
city_tier = st.selectbox("City Tier", [1, 2, 3])
|
| 49 |
typeofcontact = st.selectbox(
|
|
@@ -51,8 +56,13 @@ with st.form("customer_form"):
|
|
| 51 |
)
|
| 52 |
passport = st.selectbox("Has Passport", [0, 1])
|
| 53 |
own_car = st.selectbox("Owns Car", [0, 1])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
col3, col4 = st.columns(2)
|
|
|
|
| 56 |
with col3:
|
| 57 |
num_person_visiting = st.number_input(
|
| 58 |
"Number of People Visiting", min_value=1, max_value=10, value=2
|
|
@@ -82,22 +92,27 @@ with st.form("customer_form"):
|
|
| 82 |
|
| 83 |
if submit:
|
| 84 |
input_data = {
|
|
|
|
|
|
|
| 85 |
"Age": [age],
|
| 86 |
"TypeofContact": [typeofcontact],
|
| 87 |
"CityTier": [city_tier],
|
|
|
|
| 88 |
"Occupation": [occupation],
|
| 89 |
"Gender": [gender],
|
| 90 |
"NumberOfPersonVisiting": [num_person_visiting],
|
|
|
|
|
|
|
| 91 |
"PreferredPropertyStar": [preferred_property_star],
|
| 92 |
"MaritalStatus": [marital_status],
|
| 93 |
"NumberOfTrips": [num_trips],
|
| 94 |
"Passport": [passport],
|
|
|
|
| 95 |
"OwnCar": [own_car],
|
| 96 |
"NumberOfChildrenVisiting": [num_children_visiting],
|
| 97 |
-
"
|
| 98 |
"MonthlyIncome": [monthly_income],
|
| 99 |
-
|
| 100 |
-
"NumberOfFollowups": [number_of_followups],
|
| 101 |
"ChildrenRatio": [num_children_visiting / max(num_person_visiting, 1)],
|
| 102 |
"IncomePerPerson": [monthly_income / max(num_person_visiting, 1)],
|
| 103 |
}
|
|
|
|
| 34 |
with st.form("customer_form"):
|
| 35 |
col1, col2 = st.columns(2)
|
| 36 |
|
| 37 |
+
# Left column
|
| 38 |
with col1:
|
| 39 |
age = st.number_input("Age", min_value=18, max_value=80, value=35)
|
| 40 |
gender = st.selectbox("Gender", ["Male", "Female"])
|
|
|
|
| 44 |
occupation = st.selectbox(
|
| 45 |
"Occupation", ["Salaried", "Employee", "Freelancer", "Small Business"]
|
| 46 |
)
|
| 47 |
+
designation = st.selectbox(
|
| 48 |
+
"Designation", ["Executive", "Manager", "Senior Manager", "AVP", "VP"]
|
| 49 |
+
)
|
| 50 |
|
| 51 |
+
# Right column
|
| 52 |
with col2:
|
| 53 |
city_tier = st.selectbox("City Tier", [1, 2, 3])
|
| 54 |
typeofcontact = st.selectbox(
|
|
|
|
| 56 |
)
|
| 57 |
passport = st.selectbox("Has Passport", [0, 1])
|
| 58 |
own_car = st.selectbox("Owns Car", [0, 1])
|
| 59 |
+
product_pitched = st.selectbox(
|
| 60 |
+
"Product Pitched",
|
| 61 |
+
["Basic", "Standard", "Deluxe", "Super Deluxe", "King"],
|
| 62 |
+
)
|
| 63 |
|
| 64 |
col3, col4 = st.columns(2)
|
| 65 |
+
|
| 66 |
with col3:
|
| 67 |
num_person_visiting = st.number_input(
|
| 68 |
"Number of People Visiting", min_value=1, max_value=10, value=2
|
|
|
|
| 92 |
|
| 93 |
if submit:
|
| 94 |
input_data = {
|
| 95 |
+
# Dummy index column expected by the model
|
| 96 |
+
"Unnamed: 0": [0],
|
| 97 |
"Age": [age],
|
| 98 |
"TypeofContact": [typeofcontact],
|
| 99 |
"CityTier": [city_tier],
|
| 100 |
+
"DurationOfPitch": [duration_of_pitch],
|
| 101 |
"Occupation": [occupation],
|
| 102 |
"Gender": [gender],
|
| 103 |
"NumberOfPersonVisiting": [num_person_visiting],
|
| 104 |
+
"NumberOfFollowups": [number_of_followups],
|
| 105 |
+
"ProductPitched": [product_pitched],
|
| 106 |
"PreferredPropertyStar": [preferred_property_star],
|
| 107 |
"MaritalStatus": [marital_status],
|
| 108 |
"NumberOfTrips": [num_trips],
|
| 109 |
"Passport": [passport],
|
| 110 |
+
"PitchSatisfactionScore": [pitch_satisfaction_score],
|
| 111 |
"OwnCar": [own_car],
|
| 112 |
"NumberOfChildrenVisiting": [num_children_visiting],
|
| 113 |
+
"Designation": [designation],
|
| 114 |
"MonthlyIncome": [monthly_income],
|
| 115 |
+
# Engineered features (also used in training)
|
|
|
|
| 116 |
"ChildrenRatio": [num_children_visiting / max(num_person_visiting, 1)],
|
| 117 |
"IncomePerPerson": [monthly_income / max(num_person_visiting, 1)],
|
| 118 |
}
|