Spaces:
Runtime error
Runtime error
| import joblib | |
| from huggingface_hub import hf_hub_download | |
| import streamlit as st | |
| import pandas as pd | |
| # Download model from Hugging Face Hub | |
| model_path = hf_hub_download( | |
| repo_id="Satyanjay/Tourism_Model", | |
| filename="best_model.pkl" | |
| ) | |
| # Load the model | |
| model = joblib.load(model_path) | |
| st.title("Tourism Package Purchase Prediction") | |
| # Collect inputs | |
| Age = st.number_input("Age", 18, 100, 30) | |
| CityTier = st.selectbox("City Tier", [1, 2, 3]) | |
| DurationOfPitch = st.number_input("Duration of Pitch (minutes)", 1, 60, 10) | |
| NumberOfPersonVisiting = st.number_input("Number of Persons Visiting", 1, 10, 1) | |
| NumberOfFollowups = st.number_input("Number of Followups", 0, 20, 1) | |
| PreferredPropertyStar = st.number_input("Preferred Property Star", 1, 5, 3) | |
| NumberOfTrips = st.number_input("Number of Trips per Year", 0, 50, 1) | |
| Passport = st.selectbox("Passport (0=No, 1=Yes)", [0,1]) | |
| PitchSatisfactionScore = st.number_input("Pitch Satisfaction Score", 0, 10, 5) | |
| OwnCar = st.selectbox("Own Car (0=No, 1=Yes)", [0,1]) | |
| MonthlyIncome = st.number_input("Monthly Income", 1000, 1000000, 30000) | |
| # Convert inputs to dataframe for model | |
| input_df = pd.DataFrame([{ | |
| "Age": Age, | |
| "CityTier": CityTier, | |
| "DurationOfPitch": DurationOfPitch, | |
| "NumberOfPersonVisiting": NumberOfPersonVisiting, | |
| "NumberOfFollowups": NumberOfFollowups, | |
| "PreferredPropertyStar": PreferredPropertyStar, | |
| "NumberOfTrips": NumberOfTrips, | |
| "Passport": Passport, | |
| "PitchSatisfactionScore": PitchSatisfactionScore, | |
| "OwnCar": OwnCar, | |
| "MonthlyIncome": MonthlyIncome | |
| }]) |