| import streamlit as st | |
| import joblib | |
| import numpy as np | |
| # Load model | |
| model = joblib.load("demo/model.pkl") | |
| # App UI | |
| st.title("🧠 AI Prediction App") | |
| st.write("Enter age and salary to predict whether someone will buy the product.") | |
| # Inputs | |
| age = st.slider("Age", 18, 65, 30) | |
| salary = st.number_input("Monthly Salary", 10000, 200000, 30000) | |
| if st.button("Predict"): | |
| input_data = np.array([[age, salary]]) | |
| prediction = model.predict(input_data) | |
| result = "✅ Will Buy" if prediction[0] == 1 else "❌ Won't Buy" | |
| st.success(result) | |