Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -53,6 +53,32 @@ NumberOfFollowups = st.number_input("NumberOfFollowups (Number of follow-ups by
|
|
| 53 |
PitchSatisfactionScore = st.number_input("PitchSatisfactionScore (Pitch satisfaction score given by customer)", min_value=0, max_value=10, value=5)
|
| 54 |
PreferredPropertyStar = st.number_input("PreferredPropertyStar (Preferred rating given by customer)", min_value=1, max_value=5, value=2)
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
# Assemble input into DataFrame
|
| 57 |
input_data = pd.DataFrame([{
|
| 58 |
'Age': Age,
|
|
@@ -72,7 +98,12 @@ input_data = pd.DataFrame([{
|
|
| 72 |
'DurationOfPitch': DurationOfPitch,
|
| 73 |
'NumberOfFollowups': NumberOfFollowups,
|
| 74 |
'PitchSatisfactionScore': PitchSatisfactionScore,
|
| 75 |
-
'PreferredPropertyStar': PreferredPropertyStar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
}])
|
| 77 |
|
| 78 |
if st.button("Predict Purchase"):
|
|
|
|
| 53 |
PitchSatisfactionScore = st.number_input("PitchSatisfactionScore (Pitch satisfaction score given by customer)", min_value=0, max_value=10, value=5)
|
| 54 |
PreferredPropertyStar = st.number_input("PreferredPropertyStar (Preferred rating given by customer)", min_value=1, max_value=5, value=2)
|
| 55 |
|
| 56 |
+
# Process Feature-engineered Columns
|
| 57 |
+
def AgeGroup(age):
|
| 58 |
+
if age <= 18:
|
| 59 |
+
return 'Young'
|
| 60 |
+
elif 19 <= age <= 40:
|
| 61 |
+
return 'Adult'
|
| 62 |
+
else:
|
| 63 |
+
return 'Old'
|
| 64 |
+
|
| 65 |
+
def IncomeCategory(income):
|
| 66 |
+
if income < 20000:
|
| 67 |
+
return 'Low'
|
| 68 |
+
elif 20000 <= income <= 30000:
|
| 69 |
+
return 'Mid'
|
| 70 |
+
else:
|
| 71 |
+
return 'High'
|
| 72 |
+
|
| 73 |
+
def PitchPeriodCategory(pitch):
|
| 74 |
+
if pitch <= 10:
|
| 75 |
+
return 'Short'
|
| 76 |
+
elif 11 <= pitch <= 30:
|
| 77 |
+
return 'Long'
|
| 78 |
+
else:
|
| 79 |
+
return 'High'
|
| 80 |
+
|
| 81 |
+
|
| 82 |
# Assemble input into DataFrame
|
| 83 |
input_data = pd.DataFrame([{
|
| 84 |
'Age': Age,
|
|
|
|
| 98 |
'DurationOfPitch': DurationOfPitch,
|
| 99 |
'NumberOfFollowups': NumberOfFollowups,
|
| 100 |
'PitchSatisfactionScore': PitchSatisfactionScore,
|
| 101 |
+
'PreferredPropertyStar': PreferredPropertyStar,
|
| 102 |
+
# New derived features
|
| 103 |
+
'HasChildren': 1 if NumberOfChildrenVisiting > 0 else 0,
|
| 104 |
+
'AgeGroup': AgeGroup(Age),
|
| 105 |
+
'IncomeCategory': IncomeCategory(MonthlyIncome),
|
| 106 |
+
'PitchPeriodCategory': PitchPeriodCategory(DurationOfPitch)
|
| 107 |
}])
|
| 108 |
|
| 109 |
if st.button("Predict Purchase"):
|