File size: 1,480 Bytes
f9cbb40 8195a12 2284382 f9cbb40 8195a12 f9cbb40 b5fd6f7 2284382 6419cff b5fd6f7 |
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
import pickle
import streamlit as st
import pandas as pd
import numpy as np
st.title("Hello streamlit")
def predict(names):
model = pickle.load(open(
"model.pkl", "rb"))
# names = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
result = model.predict([names])
return result[0]
def main():
CRIM = st.number_input("CRIM")
ZN = st.number_input("proportion of residential land zoned")
INDUS = st.number_input("proportion of non-retail business acres per town")
CHAS = st.number_input(
"Charles River dummy variable (= 1 if tract bounds river; 0 otherwise)")
NOX = st.number_input("nitric oxides concentration")
RM = st.number_input("average number of rooms per dwelling")
AGE = st.number_input(
"proportion of owner-occupied units built prior to 1940")
DIS = st.number_input(
"weighted distances to five Boston employment centers")
RAD = st.number_input("index of accessibility to radial highways")
TAX = st.number_input("full-value property-tax rate per $10,000")
PTRATIO = st.number_input("pupil-teacher ratio by town")
B = st.number_input("B")
LSTAT = st.number_input("LSTAT")
names = [CRIM, ZN, INDUS, CHAS, NOX, RM, AGE, DIS, RAD, TAX, PTRATIO, B, LSTAT]
if st.button("prediction"):
# result = [names]
ans = predict(names)
st.success(f"your home price could be - {ans}")
if __name__ == "__main__":
main() |