Housing_Price_Analysis / src /streamlit_app.py
Sridhar027's picture
Update src/streamlit_app.py
60e1ab2 verified
import streamlit as st
import joblib
import numpy as np
with open("src/Housing_a","rb") as f:
model = joblib.load(f)
with open("src/X_model","rb") as f:
X_model = joblib.load(f)
st.markdown("""
<style>
body {
background: linear-gradient(to right, #e0eafc, #cfdef3);
color: #3CB371;
}
.stApp {
background-image: url("https://images.unsplash.com/photo-1506744038136-46273834b3fb?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D");
background-size: cover;
background-repeat: repeat;
}
.main {
background-color: rgba(255, 255, 255, 0.8);
padding: 2rem;
border-radius: 15px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
h1 {
text-align: center;
color: #FF4B4B;
}
</style>
""", unsafe_allow_html=True)
st.markdown("<h1 style='text-align: center; color: #FF4B4B;'>🏡 Know Your Home’s Price</h1>", unsafe_allow_html=True)
st.markdown("---")
sqft_living=st.number_input("sqft_living:",min_value=100.0, max_value=15000.0, step=1.0)
bedrooms=st.number_input("bedrooms:",min_value=1.0 ,max_value=6.0 ,step=1.0)
sqft_basement=st.number_input("sqft_basement:",min_value=1.0, max_value=5000.0, step=1.0)
floors=st.number_input("floors:",min_value=1.0, max_value=4.0, step=1.0)
if st.button("💰"):
st.snow()
model_input = np.array([[sqft_living,bedrooms,sqft_basement,floors]])
prediction = model.predict(model_input)
formated_pred = round(prediction[0],2)
st.markdown(
f"<div style='background-color:green; padding:10px; border-radius:5px'><h4 style='color:white;'>💰 Estimated Price: ₹ {formated_pred}</h4></div>",
unsafe_allow_html=True)