|
import streamlit as st
|
|
import pickle
|
|
import numpy as np
|
|
|
|
|
|
with open("house_price_model.pkl", "rb") as f:
|
|
model = pickle.load(f)
|
|
|
|
|
|
st.title("π House Price Prediction")
|
|
st.write("Enter house details to predict price")
|
|
|
|
|
|
CRIM = st.number_input("Crime Rate", 0.0, 100.0, step=0.1)
|
|
ZN = st.number_input("Proportion of Residential Land", 0.0, 100.0, step=0.1)
|
|
INDUS = st.number_input("Proportion of Non-Retail Business Acres", 0.0, 50.0, step=0.1)
|
|
CHAS = st.selectbox("Charles River (1: Yes, 0: No)", [0, 1])
|
|
NOX = st.number_input("Nitrogen Oxide Concentration", 0.0, 1.0, step=0.01)
|
|
RM = st.number_input("Average Rooms per Dwelling", 1.0, 10.0, step=0.1)
|
|
AGE = st.number_input("Proportion of Owner-Occupied Units Built Before 1940", 0.0, 100.0, step=0.1)
|
|
DIS = st.number_input("Weighted Distance to Employment Centers", 0.0, 10.0, step=0.1)
|
|
|
|
|
|
if st.button("Predict"):
|
|
features = np.array([[CRIM, ZN, INDUS, CHAS, NOX, RM, AGE, DIS]])
|
|
prediction = model.predict(features)
|
|
st.success(f"Estimated House Price: ${prediction[0]:,.2f}")
|
|
|