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("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({"LANDUSE_TYPE": [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() |