Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| import joblib | |
| from huggingface_hub import hf_hub_download | |
| st.set_page_config(page_title="Wellness Tourism Prediction", layout="centered") | |
| st.title("Wellness Tourism Purchase Prediction") | |
| st.write("Predict whether a customer will purchase the Wellness Tourism Package.") | |
| # Load model from Hugging Face Model Hub | |
| model_path = hf_hub_download( | |
| repo_id="AngadSi/wellness-purchase-prediction-model", | |
| filename="wellness_purchase_model.joblib", | |
| repo_type="model" | |
| ) | |
| model = joblib.load(model_path) | |
| # UI inputs | |
| age = st.number_input("Age", min_value=18, max_value=100, value=30) | |
| income = st.number_input("Monthly Income", min_value=0, value=6000) | |
| trips = st.number_input("Number of Trips", min_value=0, value=2) | |
| pitch_score = st.slider("Pitch Satisfaction Score", 1, 100, 80) | |
| if st.button("Predict"): | |
| df = pd.DataFrame([{ | |
| "Age": age, | |
| "MonthlyIncome": income, | |
| "NumberOfTrips": trips, | |
| "PitchSatisfactionScore": pitch_score | |
| }]) | |
| pred = model.predict(df)[0] | |
| prob = model.predict_proba(df)[0][1] | |
| st.success(f"Prediction: {'Will Purchase' if pred == 1 else 'Will Not Purchase'}") | |
| st.info(f"Purchase Probability: {round(prob, 2)}") | |