Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -5,7 +5,10 @@ import joblib
|
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
|
| 7 |
# Download and load the model
|
| 8 |
-
model_path = hf_hub_download(
|
|
|
|
|
|
|
|
|
|
| 9 |
model = joblib.load(model_path)
|
| 10 |
|
| 11 |
# Feature descriptions for UI
|
|
@@ -34,26 +37,33 @@ st.sidebar.title("Feature descriptions")
|
|
| 34 |
for k, v in feature_info.items():
|
| 35 |
st.sidebar.write(f"**{k}** — {v}")
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
| 38 |
with st.form("input_form"):
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
submitted = st.form_submit_button("Predict")
|
| 59 |
|
|
@@ -81,4 +91,4 @@ if submitted:
|
|
| 81 |
proba = model.predict_proba(input_df)[0,1]
|
| 82 |
pred = model.predict(input_df)[0]
|
| 83 |
st.write("Probability:", round(proba,3))
|
| 84 |
-
st.write("Prediction:", "Will buy (1)" if pred==1 else "Will not buy (0)")
|
|
|
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
|
| 7 |
# Download and load the model
|
| 8 |
+
model_path = hf_hub_download(
|
| 9 |
+
repo_id="Pushpak21/tourism-package-model",
|
| 10 |
+
filename="best_tourism_package_model.joblib"
|
| 11 |
+
)
|
| 12 |
model = joblib.load(model_path)
|
| 13 |
|
| 14 |
# Feature descriptions for UI
|
|
|
|
| 37 |
for k, v in feature_info.items():
|
| 38 |
st.sidebar.write(f"**{k}** — {v}")
|
| 39 |
|
| 40 |
+
st.title("🧳 Tourism Package Purchase Prediction")
|
| 41 |
+
|
| 42 |
+
# Form with two-column layout
|
| 43 |
with st.form("input_form"):
|
| 44 |
+
col1, col2 = st.columns(2)
|
| 45 |
+
|
| 46 |
+
with col1:
|
| 47 |
+
age = st.number_input("Age", min_value=18, max_value=100, value=30, help=feature_info["Age"])
|
| 48 |
+
typeof_contact = st.selectbox("Type of Contact", ["Self Enquiry", "Company Invited"], help=feature_info["TypeofContact"])
|
| 49 |
+
city_tier = st.selectbox("City Tier", [1,2,3], help=feature_info["CityTier"])
|
| 50 |
+
occupation = st.selectbox("Occupation", ["Salaried", "Free Lancer", "Small Business", "Large Business"], help=feature_info["Occupation"])
|
| 51 |
+
gender = st.selectbox("Gender", ["Male", "Female"], help=feature_info["Gender"])
|
| 52 |
+
persons = st.number_input("Number Of Person Visiting", min_value=1, max_value=5, value=2, help=feature_info["NumberOfPersonVisiting"])
|
| 53 |
+
star = st.selectbox("Preferred Property Star", [3,4,5], help=feature_info["PreferredPropertyStar"])
|
| 54 |
+
marital = st.selectbox("Marital Status", ["Single", "Married", "Divorced","Unmarried"], help=feature_info["MaritalStatus"])
|
| 55 |
+
|
| 56 |
+
with col2:
|
| 57 |
+
trips = st.number_input("Number Of Trips", min_value=1, max_value=25, value=2, help=feature_info["NumberOfTrips"])
|
| 58 |
+
passport = st.radio("Passport", [0,1], help=feature_info["Passport"])
|
| 59 |
+
owncar = st.radio("Own Car", [0,1], help=feature_info["OwnCar"])
|
| 60 |
+
children = st.number_input("Number Of Children Visiting", min_value=0, max_value=3, value=0, help=feature_info["NumberOfChildrenVisiting"])
|
| 61 |
+
designation = st.selectbox("Designation", ["Executive", "Manager", "Senior Manager", "AVP","VP"], help=feature_info["Designation"])
|
| 62 |
+
income = st.number_input("Monthly Income", min_value=1000, max_value=100000, value=30000, help=feature_info["MonthlyIncome"])
|
| 63 |
+
satisfaction = st.slider("Pitch Satisfaction Score", min_value=1, max_value=5, value=3, help=feature_info["PitchSatisfactionScore"])
|
| 64 |
+
product = st.selectbox("Product Pitched", ["Basic", "Standard","King", "Deluxe", "Super Deluxe"], help=feature_info["ProductPitched"])
|
| 65 |
+
followups = st.number_input("Number Of Followups", min_value=1, max_value=6, value=2, help=feature_info["NumberOfFollowups"])
|
| 66 |
+
duration = st.number_input("Duration Of Pitch (minutes)", min_value=0, max_value=300, value=10, help=feature_info["DurationOfPitch"])
|
| 67 |
|
| 68 |
submitted = st.form_submit_button("Predict")
|
| 69 |
|
|
|
|
| 91 |
proba = model.predict_proba(input_df)[0,1]
|
| 92 |
pred = model.predict(input_df)[0]
|
| 93 |
st.write("Probability:", round(proba,3))
|
| 94 |
+
st.write("Prediction:", "✅ Will buy (1)" if pred==1 else "❌ Will not buy (0)")
|