File size: 1,762 Bytes
27ea64b
2294c02
 
27ea64b
71630c2
2294c02
27ea64b
60e1ab2
 
 
 
c8acc7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2294c02
 
 
 
27ea64b
c8acc7a
2294c02
 
 
 
c8acc7a
 
 
27ea64b
 
 
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
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)