File size: 1,368 Bytes
b123c5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9f5208e
b123c5f
 
 
 
 
 
ea733c0
b123c5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
"""app.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1qmihuhzrIfWvaZodn-sxbyPBqKTF6Zqz
"""

import joblib
import pandas as pd
import streamlit as st
model = joblib.load('model1.joblib')
unique_values = joblib.load('unique.joblib')

unique_LANDUSE_TYPE = unique_values["LANDUSE_TYPE"]
unique_USER = unique_values["USER"]
unique_Month = unique_values["Month"]

def main():
    st.title("Water usage in town predict")
    with st.form("questionaire"):
        Land_use = st.selectbox("Land use",options = unique_LANDUSE_TYPE)
        User = st.selectbox("Gender",options = unique_USER)
        Month = st.selectbox("Hypertension",options = unique_Month)
        pipe_diam = st.slider("pipe diam",min_value=0, max_value=10)
        # clicked==True only when the button is clicked
        clicked = st.form_submit_button("Predict income")
        if clicked:
            result=model.predict(pd.DataFrame({"Land_use": [Land_use],
                                               "User": [User],
                                               "Month": [Month],
                                               "pipe_diam": [pipe_diam],}))
            # Show prediction
            st.success("Water usage predict value:",result)
if __name__ == '__main__':
    main()
# Run main()