house_price_prediction / src /streamlit_app.py
abrahamcbe's picture
Update src/streamlit_app.py
7aaadb0 verified
raw
history blame contribute delete
806 Bytes
import streamlit as st
import joblib
import numpy as np
with open("src/house_model", "rb") as f:
model = joblib.load(f)
st.title(":blue[Smart] Property Price Estimator :house:")
bedrooms = st.number_input("Bedrooms:", min_value=1, max_value=10, step=1)
bathrooms = st.number_input("Bathrooms:", min_value=1, max_value=10, step=1)
sqft_living = st.number_input("Living Area (sqft):", min_value=100, max_value=10000, step=1)
floors = st.number_input("Number of Floors:", min_value=1, max_value=10, step=1)
if st.button("Analysis"):
st.snow()
model_input = np.array([[bedrooms, bathrooms, sqft_living, floors]])
prediction = model.predict(model_input)
formatted_pred = round(prediction[0],2)
st.success(f"The estimated price for your selected 🏡 property is: ${formatted_pred:,}")