Spaces:
Runtime error
Runtime error
# -*- 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("User",options = unique_USER) | |
Month = st.selectbox("Month",options = unique_Month) | |
pipe_diam = st.number_input("pipe diameter:",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], | |
"PIPE DIAM": [pipe_diam]})) | |
str_result = str(result).strip("[]") | |
st.success("Water usage predict value:"+str_result+"cubic meters") | |
if __name__ == '__main__': | |
main() |