File size: 1,533 Bytes
b123c5f
 
 
 
 
 
 
 
 
 
 
 
30ac382
b123c5f
 
9f5208e
b123c5f
 
30ac382
b123c5f
 
 
 
ea733c0
394db98
 
30ac382
90100f1
7017db6
b123c5f
d854e6e
 
e1f8d69
30ac382
d854e6e
566c988
73c52a6
b123c5f
fb49a86
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
39
# -*- 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('model.joblib')
unique_values = joblib.load('unique.joblib')

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

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("User",options = unique_USER)
        Month = st.selectbox("Month",options = unique_Month)
        vendor = st.selectbox("Vendor",options = unique_vendor)
        pipe_diam = st.number_input("pipe diameter(meter):",min_value=0.5, max_value=10.0, step=0.5)
        clicked = st.form_submit_button("start predict ")
        if clicked:
            result=model.predict(pd.DataFrame({"LANDUSE_TYPE": [Land_use],
                                               "USER": [User],
                                               "Month": [Month],
                                               "VENDOR": [vendor],
                                               "PIPE DIAM": [pipe_diam]}))
            str_result = str(result).strip("[]")
            st.success("Water usage predict value:"+str_result+"cubic meters")
if __name__ == '__main__':
    main()