Spaces:
Build error
Build error
Create new file
Browse files- app_tree.py +19 -0
app_tree.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import joblib
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
model = joblib.load('model.joblib')
|
| 5 |
+
|
| 6 |
+
def main():
|
| 7 |
+
st.title("Network Ads")
|
| 8 |
+
with st.form("questionaire"):
|
| 9 |
+
age = st.slider('Age',min_value=10,max_value=100)
|
| 10 |
+
salary = st.slider('Estimated Salary',min_value=10000,max_value=100000)
|
| 11 |
+
clicked = st.form_submit_button("Predict income")
|
| 12 |
+
if clicked:
|
| 13 |
+
result=model.predict(pd.DataFrame({"age": [age],'Estimated Salary':[salary]}))
|
| 14 |
+
# Show prediction
|
| 15 |
+
result ='Buy' if result[0]==1 else '<=Not Buy'
|
| 16 |
+
st.success("You will" +result+"this product")
|
| 17 |
+
# Run main()
|
| 18 |
+
if __name__=="__main__":
|
| 19 |
+
main()
|