skalpitin commited on
Commit
1efeb6e
·
verified ·
1 Parent(s): 19bfa3d

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -3,38 +3,38 @@ import pandas as pd
3
  from huggingface_hub import hf_hub_download
4
  import joblib
5
 
6
- # Download the model from the Model Hub
7
  model_path = hf_hub_download(repo_id="skalpitin/Tourism-Package-Prediction", filename="Tourism-Package-Prediction_v1.joblib")
8
 
9
- # Load the model
10
  model = joblib.load(model_path)
11
 
12
  # Streamlit UI for Customer Churn Prediction
13
- st.title("Visit with us Prediction App")
14
- st.write("The Visit with us Prediction App is an internal tool for the internal staff that predicts whether customers are going to take the tourism package or not.")
15
  st.write("Kindly enter the customer details to check whether they are buy the tourism package.")
16
 
17
- # Collect user input
18
- Age = st.number_input("Age (customer's age in years)", min_value=18, max_value=100, value=30)
19
  TypeofContact = st.selectbox("Type of contact", ["Company Invited", "Self Inquiry"])
20
  CityTier = st.selectbox("City Tier", ["Tier 1", "Tier 2", "Tier 3"])
21
  Occupation = st.selectbox("Occupation", ["Salaried", "Freelancer", "Large Business", "Small Business"])
22
  Gender = st.selectbox("Gender", ["Male", "Female"])
23
- NumberOfPersonVisiting = st.number_input("Number Of Person Visiting", min_value=0, max_value=25, value=2)
24
  PreferredPropertyStar = st.selectbox("Preferred Property Star", ["1", "2", "3","4", "5"])
25
  MaritalStatus = st.selectbox("Marital Status", ["Single", "Married", "Divorced"])
26
- NumberOfTrips = st.number_input("Number Of Trips", min_value=0, max_value=50, value=5)
27
  Passport = st.selectbox("Has Passport?", ["Yes", "No"])
28
  OwnCar = st.selectbox("Owns Car?", ["Yes", "No"])
29
- NumberOfChildrenVisiting = st.number_input("Number Of Children (Below 5) Visiting", min_value=0, max_value=10, value=2)
30
  Designation = st.selectbox("Designation", ["Executive", "Manager", "AVP", "Senior Manager", "VP"])
31
- MonthlyIncome = st.number_input("Monthly Income", min_value=0.0, max_value=50000.0, value=5000.0)
32
  PitchSatisfactionScore = st.selectbox("Pitch Satisfaction Score", ["1", "2", "3","4", "5"])
33
  ProductPitched = st.selectbox("Product Pitched", ["Basic", "Deluxe", "King", "Standard", "Super Deluxe"])
34
  NumberOfFollowups = st.selectbox("Number Of Followups", ["1", "2", "3","4", "5"])
35
  DurationOfPitch = st.number_input("Duration Of Pitch", min_value=0.0, value=30.0)
36
 
37
- # Convert categorical inputs to match model training
38
  input_data = pd.DataFrame([{
39
  'Age': Age,
40
  'TypeofContact': TypeofContact,
@@ -56,10 +56,10 @@ input_data = pd.DataFrame([{
56
  'DurationOfPitch': DurationOfPitch
57
  }])
58
 
59
- # Set the classification threshold
60
  classification_threshold = 0.45
61
 
62
- # Predict button
63
  if st.button("Predict"):
64
  prediction_proba = model.predict_proba(input_data)[0, 1]
65
  prediction = (prediction_proba >= classification_threshold).astype(int)
 
3
  from huggingface_hub import hf_hub_download
4
  import joblib
5
 
6
+ # Downloading the model from the Model Hub
7
  model_path = hf_hub_download(repo_id="skalpitin/Tourism-Package-Prediction", filename="Tourism-Package-Prediction_v1.joblib")
8
 
9
+ # Loading the model
10
  model = joblib.load(model_path)
11
 
12
  # Streamlit UI for Customer Churn Prediction
13
+ st.title("`Visit with us` Prediction App")
14
+ st.write("The `Visit with us` Prediction App is an internal tool for the internal staff that predicts whether customers are going to take the tourism package or not.")
15
  st.write("Kindly enter the customer details to check whether they are buy the tourism package.")
16
 
17
+ # Collecting user input
18
+ Age = st.number_input("Age (customer's age in years)", min_value=18, value=25)
19
  TypeofContact = st.selectbox("Type of contact", ["Company Invited", "Self Inquiry"])
20
  CityTier = st.selectbox("City Tier", ["Tier 1", "Tier 2", "Tier 3"])
21
  Occupation = st.selectbox("Occupation", ["Salaried", "Freelancer", "Large Business", "Small Business"])
22
  Gender = st.selectbox("Gender", ["Male", "Female"])
23
+ NumberOfPersonVisiting = st.number_input("Number Of Person Visiting", min_value=0, max_value=25, value=1)
24
  PreferredPropertyStar = st.selectbox("Preferred Property Star", ["1", "2", "3","4", "5"])
25
  MaritalStatus = st.selectbox("Marital Status", ["Single", "Married", "Divorced"])
26
+ NumberOfTrips = st.number_input("Number Of Trips", min_value=0, value=5)
27
  Passport = st.selectbox("Has Passport?", ["Yes", "No"])
28
  OwnCar = st.selectbox("Owns Car?", ["Yes", "No"])
29
+ NumberOfChildrenVisiting = st.number_input("Number Of Children (Below 5) Visiting", min_value=0, value=2)
30
  Designation = st.selectbox("Designation", ["Executive", "Manager", "AVP", "Senior Manager", "VP"])
31
+ MonthlyIncome = st.number_input("Monthly Income", min_value=0.0, value=5000.0)
32
  PitchSatisfactionScore = st.selectbox("Pitch Satisfaction Score", ["1", "2", "3","4", "5"])
33
  ProductPitched = st.selectbox("Product Pitched", ["Basic", "Deluxe", "King", "Standard", "Super Deluxe"])
34
  NumberOfFollowups = st.selectbox("Number Of Followups", ["1", "2", "3","4", "5"])
35
  DurationOfPitch = st.number_input("Duration Of Pitch", min_value=0.0, value=30.0)
36
 
37
+ # Converting inputs to a dataframe to pass to the model
38
  input_data = pd.DataFrame([{
39
  'Age': Age,
40
  'TypeofContact': TypeofContact,
 
56
  'DurationOfPitch': DurationOfPitch
57
  }])
58
 
59
+ # Setting the classification threshold
60
  classification_threshold = 0.45
61
 
62
+ # Predict button - Calling the model with input dataframe
63
  if st.button("Predict"):
64
  prediction_proba = model.predict_proba(input_data)[0, 1]
65
  prediction = (prediction_proba >= classification_threshold).astype(int)