File size: 3,077 Bytes
32b6b37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f545108
6332842
32b6b37
6332842
32b6b37
6332842
32b6b37
 
 
6332842
 
f545108
32b6b37
 
6332842
32b6b37
 
 
 
 
 
f545108
32b6b37
 
 
 
 
 
 
 
 
f545108
32b6b37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import streamlit as st
import pandas as pd
from huggingface_hub import hf_hub_download
import joblib

# Download and load the trained model
model_path = hf_hub_download(repo_id="krishpvg/visit-with-us", filename="best_product_taken_model_v1.joblib")
model = joblib.load(model_path)

# Streamlit UI
st.title("Tourism package Prediction")
st.write("""
Tourism package prediction.
""")

# User input
TypeofContact = st.selectbox("Type of contact", ["Self Enquiry", "Company Invited"])
CityTier = int(st.selectbox("City Tier", ["1", "2", "3"]))
Occupation = st.selectbox("Occupation", ["Salaried", "Free Lancer", "Small Business", "Large Business"])
Gender = st.selectbox("Gender", ["Male", "Female"])
Age = st.number_input("Age",min_value=18, max_value=70, value=18, step=1)
MaritalStatus = st.selectbox("Marital StatusType of contact", ["Single", "Married", "Unmarried", "Divorced"])
Passport = st.checkbox("Passport available?")
Passport = int(Passport)
OwnCar = st.checkbox("Own a car available?")
OwnCar = int(OwnCar)
Designation = st.selectbox("Designation", ["Executive", "Managerial", "Professional", "Other"])
MonthlyIncome = st.number_input("Monthly Income",min_value=1000, max_value=1000000, value=1000, step=1)
PreferredPropertyStar = int(st.selectbox("Preferred Property Star", ["3", "4", "5"]))
NumberOfChildrenVisiting = int(st.selectbox("Number of children visiting", ["0", "1", "2", "3", "4", "5"]))
NumberOfTrips = st.number_input("Number of trips",min_value=1, max_value=50, value=1, step=1)
PitchSatisfactionScore = int(st.selectbox("Pitch Satisfaction Score", ["1", "2", "3", "4", "5"]))
ProductPitched = st.selectbox("Product Pitched", ["Basic", "Standard", "Deluxe", "Super Deluxe", "King"])
NumberOfFollowups = st.number_input("Number of Followups",min_value=1, max_value=10, value=1, step=1)
DurationOfPitch = st.number_input("Duration of Pitch",min_value=1, max_value=100, value=1, step=1)

# Assemble input into DataFrame
input_data = pd.DataFrame([{
    'TypeofContact': TypeofContact,
    'CityTier': CityTier,
    'Gender' : Gender,
    'Occupation': Occupation,
    'PreferredPropertyStar': PreferredPropertyStar,
    'MaritalStatus': MaritalStatus,
    'Passport': Passport,
    'OwnCar': OwnCar,
    'NumberOfChildrenVisiting': NumberOfChildrenVisiting,
    'Designation': Designation,
    'MonthlyIncome': MonthlyIncome,
    'Age': Age,
    'NumberOfTrips': NumberOfTrips,
    'PitchSatisfactionScore': PitchSatisfactionScore,
    'ProductPitched': ProductPitched,
    'NumberOfFollowups': NumberOfFollowups,
    'DurationOfPitch': DurationOfPitch
}])

# Predict button
if st.button("Predict Tourism Package Purchase"):
    prediction = model.predict(input_data)[0]
    prediction_prob = model.predict_proba(input_data)[0, 1]

    st.subheader("Prediction Result:")
    if prediction == 1:
        st.success("The customer is likely to purchase the tourism package ✅")
    else:
        st.warning("The customer is unlikely to purchase the tourism package ❌")
    
    st.info(f"Predicted probability of purchase: {prediction_prob*100:.2f}%")