| import streamlit as st |
| import pandas as pd |
| from huggingface_hub import hf_hub_download |
| import joblib |
|
|
| |
| model_path = hf_hub_download(repo_id="Santhu976/Tourism-Package-Prediction", filename="best_machine_failure_model_v1.joblib") |
| model = joblib.load(model_path) |
|
|
| |
| st.title("Wellness Tourism Package Prediction") |
| st.write(""" |
| This application predicts whether a customer is likely to purchase |
| the **Wellness Tourism Package** based on demographic and interaction details. |
| """) |
|
|
| st.header("Customer Details") |
|
|
| |
| age = st.number_input("Age", min_value=18, max_value=100, value=35) |
| typeof_contact = st.selectbox( |
| "Type of Contact", |
| ["Company Invited", "Self Inquiry"] |
| ) |
| city_tier = st.selectbox( |
| "City Tier", |
| [1, 2, 3] |
| ) |
| occupation = st.selectbox( |
| "Occupation", |
| ["Salaried", "Small Business", "Large Business", "Freelancer"] |
| ) |
| gender = st.selectbox( |
| "Gender", |
| ["Male", "Female"] |
| ) |
| num_person_visiting = st.number_input( |
| "Number of People Visiting", |
| min_value=1, max_value=10, value=2 |
| ) |
| preferred_property_star = st.selectbox( |
| "Preferred Property Star", |
| [1, 2, 3, 4, 5] |
| ) |
| marital_status = st.selectbox( |
| "Marital Status", |
| ["Single", "Married", "Divorced"] |
| ) |
| num_trips = st.number_input( |
| "Number of Trips (per year)", |
| min_value=0, max_value=50, value=2 |
| ) |
| passport = st.selectbox( |
| "Passport Available", |
| [0, 1], |
| format_func=lambda x: "Yes" if x == 1 else "No" |
| ) |
| own_car = st.selectbox( |
| "Owns a Car", |
| [0, 1], |
| format_func=lambda x: "Yes" if x == 1 else "No" |
| ) |
| num_children = st.number_input( |
| "Number of Children Visiting (below 5)", |
| min_value=0, max_value=5, value=0 |
| ) |
| designation = st.selectbox( |
| "Designation", |
| ["Executive", "Manager", "Senior Manager", "AVP", "VP"] |
| ) |
| monthly_income = st.number_input( |
| "Monthly Income", |
| min_value=0, value=50000, step=1000 |
| ) |
|
|
| |
| |
| |
|
|
| st.header("Customer Interaction Details") |
|
|
| pitch_score = st.slider( |
| "Pitch Satisfaction Score", |
| min_value=1, max_value=5, value=3 |
| ) |
| product_pitched = st.selectbox( |
| "Product Pitched", |
| ["Basic", "Standard", "Deluxe", "Super Deluxe"] |
| ) |
| num_followups = st.number_input( |
| "Number of Follow-ups", |
| min_value=0, max_value=20, value=2 |
| ) |
| duration_of_pitch = st.number_input( |
| "Duration of Pitch (minutes)", |
| min_value=0, max_value=120, value=20 |
| ) |
|
|
| |
| input_data = pd.DataFrame([{ |
| "Age": age, |
| "TypeofContact": typeof_contact, |
| "CityTier": city_tier, |
| "Occupation": occupation, |
| "Gender": gender, |
| "NumberOfPersonVisiting": num_person_visiting, |
| "PreferredPropertyStar": preferred_property_star, |
| "MaritalStatus": marital_status, |
| "NumberOfTrips": num_trips, |
| "Passport": passport, |
| "OwnCar": own_car, |
| "NumberOfChildrenVisiting": num_children, |
| "Designation": designation, |
| "MonthlyIncome": monthly_income, |
| "PitchSatisfactionScore": pitch_score, |
| "ProductPitched": product_pitched, |
| "NumberOfFollowups": num_followups, |
| "DurationOfPitch": duration_of_pitch |
| }]) |
|
|
|
|
| if st.button("Predict Purchase"): |
| prediction = model.predict(input_data)[0] |
| result = "Customer WILL Purchase the Package" if prediction == 1 else "Customer will NOT Purchase the Package" |
|
|
| st.subheader("Prediction Result") |
| st.success(result) |
|
|