File size: 675 Bytes
94e3192
 
 
cf29d7a
94e3192
 
 
 
 
 
 
 
 
 
f8c29b5
 
94e3192
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import joblib
import pandas as pd
import streamlit as st
model = joblib.load('model_tree.joblib')

def main():
    st.title("Network Ads")
    with st.form("questionaire"):
        age = st.slider('Age',min_value=10,max_value=100)
        salary = st.slider('Estimated Salary',min_value=10000,max_value=100000)
        clicked = st.form_submit_button("Predict income")
        if clicked:
            result=model.predict(pd.DataFrame({"age": [age],'Estimated Salary':[salary]}))
            # Show prediction
            result ='buy' if result[0]==1 else 'not buy'
            st.success("You will " +result+" this product")
# Run main()
if __name__=="__main__":
    main()