Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -34,58 +34,58 @@ with col1:
|
|
34 |
st.subheader('Features')
|
35 |
|
36 |
with st.container():
|
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 |
-
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
|
90 |
# Display the map in the second column
|
91 |
with col2:
|
|
|
34 |
st.subheader('Features')
|
35 |
|
36 |
with st.container():
|
37 |
+
st.markdown('<div class="scroll-container">', unsafe_allow_html=True)
|
38 |
+
|
39 |
+
# Create two columns for City and Waterfront
|
40 |
+
col3, col4 = st.columns(2)
|
41 |
+
|
42 |
+
# City dropdown in the first column
|
43 |
+
with col3:
|
44 |
+
city = st.selectbox('City', list(cities_geo.keys()))
|
45 |
+
|
46 |
+
# Waterfront checkbox in the second column
|
47 |
+
with col4:
|
48 |
+
waterfront = st.checkbox('Waterfront', value=False)
|
49 |
+
|
50 |
+
# city = st.selectbox('City', list(cities_geo.keys())) # Display city dropdown in the first column
|
51 |
+
# waterfront = st.checkbox('Waterfront', value=False)
|
52 |
+
bedrooms = st.slider('Bedrooms', min_value=min_dict['bedrooms'], max_value=max_dict['bedrooms'], value=3)
|
53 |
+
bathrooms = st.slider('Bathrooms', min_value=min_dict['bathrooms'], max_value=max_dict['bathrooms'], value=2)
|
54 |
+
sqft_living = st.slider('Square Feet (Living)', min_value=min_dict['sqft_living'], max_value=max_dict['sqft_living'], value=1000)
|
55 |
+
sqft_lot = st.slider('Square Feet (Lot)', min_value=min_dict['sqft_lot'], max_value=max_dict['sqft_lot'], value=2000)
|
56 |
+
floors = st.slider('Floors', min_value=min_dict['floors'], max_value=max_dict['floors'], value=1)
|
57 |
+
view = st.slider('View', min_value=min_dict['view'], max_value=max_dict['view'], value=0)
|
58 |
+
condition = st.slider('Condition', min_value=min_dict['condition'], max_value=max_dict['condition'], value=3)
|
59 |
+
sqft_above = st.slider('Square Feet (Above)', min_value=min_dict['sqft_above'], max_value=max_dict['sqft_above'], value=1000)
|
60 |
+
sqft_basement = st.slider('Square Feet (Basement)', min_value=min_dict['sqft_basement'], max_value=max_dict['sqft_basement'], value=0)
|
61 |
+
yr_built = st.slider('Year Built', min_value=min_dict['yr_built'], max_value=max_dict['yr_built'], value=2000)
|
62 |
+
yr_renovated = st.slider('Year Renovated', min_value=min_dict['yr_renovated'], max_value=max_dict['yr_renovated'], value=2010)
|
63 |
+
|
64 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
65 |
|
66 |
+
new_pred = init_new_pred()
|
67 |
+
new_pred['bedrooms'] = bedrooms
|
68 |
+
new_pred['bathrooms'] = bathrooms
|
69 |
+
new_pred['sqft_living'] = sqft_living
|
70 |
+
new_pred['sqft_lot'] = sqft_lot
|
71 |
+
new_pred['floors'] = floors
|
72 |
+
new_pred['waterfront'] = int(waterfront)
|
73 |
+
new_pred['view'] = view
|
74 |
+
new_pred['condition'] = condition
|
75 |
+
new_pred['sqft_above'] = sqft_above
|
76 |
+
new_pred['sqft_basement'] = sqft_basement
|
77 |
+
new_pred['yr_built'] = yr_built
|
78 |
+
new_pred['yr_renovated'] = yr_renovated
|
79 |
+
new_pred[f'city_{city}'] = 1
|
80 |
+
|
81 |
+
# Process the prediction
|
82 |
+
new_pred = pd.DataFrame([new_pred])
|
83 |
+
new_pred = create_new_features(new_pred)
|
84 |
+
new_pred = bucketize(new_pred)
|
85 |
+
new_pred = normalize(new_pred)
|
86 |
+
|
87 |
+
# Predict the price
|
88 |
+
predicted_price = model.predict(new_pred)
|
89 |
|
90 |
# Display the map in the second column
|
91 |
with col2:
|