Vaddiritz commited on
Commit
564459b
·
verified ·
1 Parent(s): 2246a98

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +59 -0
app.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import streamlit as st
3
+ import pandas as pd
4
+ import joblib
5
+ from huggingface_hub import hf_hub_download
6
+ from sklearn.preprocessing import LabelEncoder
7
+
8
+ # Download and load model from Hugging Face
9
+ model_path = hf_hub_download(repo_id="Vaddiritz/Tourism-Package-Prediction-rithika", filename="best_tourism_model_v1.joblib")
10
+ model = joblib.load(model_path)
11
+
12
+ # Streamlit UI
13
+ st.title("Tourism Package Recommendation App")
14
+ st.write("""
15
+ This application predicts whether a customer is likely to purchase a **tourism package**
16
+ based on their profile and preferences.
17
+ Fill in the details below to get a prediction.
18
+ """)
19
+
20
+ # Customer Details
21
+ age = st.number_input("Age", min_value=18, max_value=100, value=30)
22
+ typeofcontact = st.selectbox("Type of Contact", ["Company Invited", "Self Inquiry"])
23
+ citytier = st.selectbox("City Tier", [1, 2, 3])
24
+ occupation = st.selectbox("Occupation", ["Salaried", "Freelancer"])
25
+ gender = st.selectbox("Gender", ["Male", "Female"])
26
+ numberofpersonvisiting = st.number_input("Number Of Person Visiting", min_value=1, max_value=10, value=1)
27
+ preferredpropertystar = st.selectbox("Preferred Property Star", [1, 2, 3, 4, 5])
28
+ maritalstatus = st.selectbox("Marital Status", ["Single", "Married", "Divorced"])
29
+ numberoftrips = st.number_input("Number Of Trips", min_value=0, max_value=20, value=1)
30
+ passport = st.selectbox("Passport", [0, 1])
31
+ owncar = st.selectbox("Own Car", [0, 1])
32
+ numberofchildrenvisiting = st.number_input("Number Of Children Visiting", min_value=0, max_value=10, value=0)
33
+ designation = st.selectbox("Designation", ["Manager", "Executive", "Senior Manager", "AVP"])
34
+ monthlyincome = st.number_input("Monthly Income", min_value=1000, value=50000)
35
+ pitchsatisfactionscore = st.slider("Pitch Satisfaction Score", 1, 5, 3)
36
+ productpitched = st.selectbox("Product Pitched", ["Basic", "Deluxe", "Super Deluxe", "King", "Standard"])
37
+ numberoffollowups = st.number_input("Number Of Followups", min_value=0, max_value=20, value=2)
38
+ durationofpitch = st.number_input("Duration Of Pitch (minutes)", min_value=0, max_value=60, value=10)
39
+
40
+ # --- Create input dataframe ---
41
+ input_data = pd.DataFrame([[age, typeofcontact, citytier, occupation, gender,numberofpersonvisiting, preferredpropertystar,
42
+ maritalstatus,numberoftrips, passport, owncar, numberofchildrenvisiting, designation,
43
+ monthlyincome, pitchsatisfactionscore, productpitched,numberoffollowups, durationofpitch]],
44
+ columns=["Age", "TypeofContact", "CityTier", "Occupation", "Gender",
45
+ "NumberOfPersonVisiting", "PreferredPropertyStar", "MaritalStatus",
46
+ "NumberOfTrips", "Passport", "OwnCar", "NumberOfChildrenVisiting",
47
+ "Designation", "MonthlyIncome", "PitchSatisfactionScore", "ProductPitched",
48
+ "NumberOfFollowups", "DurationOfPitch"])
49
+
50
+
51
+ # Display input summary
52
+ st.subheader("Entered Details:")
53
+ st.write(input_data)
54
+
55
+ if st.button("Predict Package Purchase"):
56
+ prediction = model.predict(input_data)[0]
57
+ result = "Likely to Purchase Package" if prediction == 1 else "Unlikely to Purchase"
58
+ st.subheader("Prediction Result:")
59
+ st.success(result)