Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,20 @@ with open('./trained_model.pkl', 'rb') as file:
|
|
9 |
# Placeholder for displaying the predicted price at the top
|
10 |
price_placeholder = st.empty()
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# Define min and max values from the dictionaries
|
13 |
min_dict = {
|
14 |
'bedrooms': 0,
|
@@ -50,7 +64,7 @@ bathrooms = st.slider('Bathrooms', min_value=min_dict['bathrooms'], max_value=ma
|
|
50 |
sqft_living = st.slider('Square Feet (Living)', min_value=min_dict['sqft_living'], max_value=max_dict['sqft_living'], value=min_dict['sqft_living'])
|
51 |
sqft_lot = st.slider('Square Feet (Lot)', min_value=min_dict['sqft_lot'], max_value=max_dict['sqft_lot'], value=min_dict['sqft_lot'])
|
52 |
floors = st.slider('Floors', min_value=min_dict['floors'], max_value=max_dict['floors'], value=min_dict['floors'])
|
53 |
-
waterfront = st.
|
54 |
view = st.slider('View', min_value=min_dict['view'], max_value=max_dict['view'], value=min_dict['view'])
|
55 |
condition = st.slider('Condition', min_value=min_dict['condition'], max_value=max_dict['condition'], value=min_dict['condition'])
|
56 |
sqft_above = st.slider('Square Feet (Above)', min_value=min_dict['sqft_above'], max_value=max_dict['sqft_above'], value=min_dict['sqft_above'])
|
@@ -77,14 +91,14 @@ if (bedrooms != min_dict['bedrooms'] or
|
|
77 |
new_pred['sqft_living'] = sqft_living
|
78 |
new_pred['sqft_lot'] = sqft_lot
|
79 |
new_pred['floors'] = floors
|
80 |
-
new_pred['waterfront'] = waterfront
|
81 |
new_pred['view'] = view
|
82 |
new_pred['condition'] = condition
|
83 |
new_pred['sqft_above'] = sqft_above
|
84 |
new_pred['sqft_basement'] = sqft_basement
|
85 |
new_pred['yr_built'] = yr_built
|
86 |
new_pred['yr_renovated'] = yr_renovated
|
87 |
-
new_pred['
|
88 |
|
89 |
# Process the prediction
|
90 |
new_pred = pd.DataFrame([new_pred])
|
|
|
9 |
# Placeholder for displaying the predicted price at the top
|
10 |
price_placeholder = st.empty()
|
11 |
|
12 |
+
city = st.selectbox(
|
13 |
+
'Select City',
|
14 |
+
['Algona', 'Auburn', 'Beaux Arts Village', 'Bellevue',
|
15 |
+
'Black Diamond', 'Bothell', 'Burien', 'Carnation', 'Clyde Hill',
|
16 |
+
'Covington', 'Des Moines', 'Duvall', 'Enumclaw', 'Fall City',
|
17 |
+
'Federal Way', 'Inglewood-Finn Hill', 'Issaquah', 'Kenmore',
|
18 |
+
'Kent', 'Kirkland', 'Lake Forest Park', 'Maple Valley', 'Medina',
|
19 |
+
'Mercer Island', 'Milton', 'Newcastle', 'Normandy Park',
|
20 |
+
'North Bend', 'Pacific', 'Preston', 'Ravensdale', 'Redmond',
|
21 |
+
'Renton', 'Sammamish', 'SeaTac', 'Seattle', 'Shoreline',
|
22 |
+
'Skykomish', 'Snoqualmie', 'Snoqualmie Pass', 'Tukwila', 'Vashon',
|
23 |
+
'Woodinville', 'Yarrow Point']
|
24 |
+
)
|
25 |
+
|
26 |
# Define min and max values from the dictionaries
|
27 |
min_dict = {
|
28 |
'bedrooms': 0,
|
|
|
64 |
sqft_living = st.slider('Square Feet (Living)', min_value=min_dict['sqft_living'], max_value=max_dict['sqft_living'], value=min_dict['sqft_living'])
|
65 |
sqft_lot = st.slider('Square Feet (Lot)', min_value=min_dict['sqft_lot'], max_value=max_dict['sqft_lot'], value=min_dict['sqft_lot'])
|
66 |
floors = st.slider('Floors', min_value=min_dict['floors'], max_value=max_dict['floors'], value=min_dict['floors'])
|
67 |
+
waterfront = st.checkbox('Waterfront', value=False)
|
68 |
view = st.slider('View', min_value=min_dict['view'], max_value=max_dict['view'], value=min_dict['view'])
|
69 |
condition = st.slider('Condition', min_value=min_dict['condition'], max_value=max_dict['condition'], value=min_dict['condition'])
|
70 |
sqft_above = st.slider('Square Feet (Above)', min_value=min_dict['sqft_above'], max_value=max_dict['sqft_above'], value=min_dict['sqft_above'])
|
|
|
91 |
new_pred['sqft_living'] = sqft_living
|
92 |
new_pred['sqft_lot'] = sqft_lot
|
93 |
new_pred['floors'] = floors
|
94 |
+
new_pred['waterfront'] = int(waterfront)
|
95 |
new_pred['view'] = view
|
96 |
new_pred['condition'] = condition
|
97 |
new_pred['sqft_above'] = sqft_above
|
98 |
new_pred['sqft_basement'] = sqft_basement
|
99 |
new_pred['yr_built'] = yr_built
|
100 |
new_pred['yr_renovated'] = yr_renovated
|
101 |
+
new_pred[f'city_{city}'] = 1
|
102 |
|
103 |
# Process the prediction
|
104 |
new_pred = pd.DataFrame([new_pred])
|