|
|
import streamlit as st |
|
|
import pandas as pd |
|
|
import numpy as np |
|
|
from huggingface_hub import hf_hub_download |
|
|
import joblib |
|
|
|
|
|
st.set_page_config(page_title="Tourism Package Prediction", layout="wide") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MODEL_REPO = "sumitsinha2603/TourismPackagePredictionAnalysisModel" |
|
|
MODEL_FILE = "TourismPackagePredictionAnalysisModel_v1.joblib" |
|
|
|
|
|
model_path = hf_hub_download( |
|
|
repo_id=MODEL_REPO, |
|
|
filename=MODEL_FILE, |
|
|
repo_type="model" |
|
|
) |
|
|
|
|
|
model = joblib.load(model_path) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st.title("ποΈ Tourism Package Prediction App") |
|
|
st.write("Predict whether the customer will buy a package.") |
|
|
|
|
|
|
|
|
TypeofContact = st.selectbox("Type of Contact", ["Company Invited", "Self Enquiry"]) |
|
|
Occupation = st.selectbox("Occupation", ["Salaried", "Small Business", "Large Business", "Free Lancer"]) |
|
|
Gender = st.selectbox("Gender", ["Male", "Female"]) |
|
|
ProductPitched = st.selectbox("Product Pitched", ["Basic", "Standard", "Deluxe"]) |
|
|
MaritalStatus = st.selectbox("Marital Status", ["Single", "Married"]) |
|
|
Designation = st.selectbox("Designation", ["Executive", "Senior Executive", "Manager"]) |
|
|
|
|
|
Age = st.number_input("Age", min_value=18, max_value=90) |
|
|
NoOfFollowups = st.number_input("No of Followups", min_value=0, max_value=20) |
|
|
DurationOfPitch = st.number_input("Duration of Pitch", min_value=0, max_value=100) |
|
|
|
|
|
if st.button("Predict"): |
|
|
input_data = pd.DataFrame([[ |
|
|
TypeofContact, Occupation, Gender, ProductPitched, MaritalStatus, Designation, |
|
|
Age, NoOfFollowups, DurationOfPitch |
|
|
]], columns=[ |
|
|
"TypeofContact", "Occupation", "Gender", "ProductPitched", |
|
|
"MaritalStatus", "Designation", |
|
|
"Age", "NoOfFollowups", "DurationOfPitch" |
|
|
]) |
|
|
|
|
|
pred = model.predict(input_data)[0] |
|
|
|
|
|
if pred == 1: |
|
|
st.success("π Customer is likely to buy the package!") |
|
|
else: |
|
|
st.error("π Customer is NOT likely to buy the package.") |
|
|
|