Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -6,12 +6,12 @@ from utils import create_new_features, normalize, bucketize, init_new_pred
|
|
6 |
|
7 |
with open('./trained_model.pkl', 'rb') as file:
|
8 |
model = pickle.load(file)
|
9 |
-
|
10 |
with open("./min_dict.json", "r") as f:
|
11 |
min_dict = json.load(f)
|
12 |
-
|
13 |
with open("./max_dict.json", "r") as f:
|
14 |
max_dict = json.load(f)
|
|
|
|
|
15 |
|
16 |
st.set_page_config(layout="wide")
|
17 |
|
@@ -80,225 +80,228 @@ with col2:
|
|
80 |
f"<h1 style='font-size: 24px;'>Predicted Price: ${predicted_price[0][0]:,.2f}</h1>",
|
81 |
unsafe_allow_html=True
|
82 |
)
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
|
|
303 |
|
304 |
st.map(map_data, zoom=11)
|
|
|
6 |
|
7 |
with open('./trained_model.pkl', 'rb') as file:
|
8 |
model = pickle.load(file)
|
|
|
9 |
with open("./min_dict.json", "r") as f:
|
10 |
min_dict = json.load(f)
|
|
|
11 |
with open("./max_dict.json", "r") as f:
|
12 |
max_dict = json.load(f)
|
13 |
+
with open("./cities_geo.json", "r") as f:
|
14 |
+
cities_geo = json.load(f)
|
15 |
|
16 |
st.set_page_config(layout="wide")
|
17 |
|
|
|
80 |
f"<h1 style='font-size: 24px;'>Predicted Price: ${predicted_price[0][0]:,.2f}</h1>",
|
81 |
unsafe_allow_html=True
|
82 |
)
|
83 |
+
|
84 |
+
map_data = cities_geo[pd.DataFrame(city)]
|
85 |
+
|
86 |
+
# if city == 'Seattle':
|
87 |
+
# map_data = pd.DataFrame({
|
88 |
+
# 'latitude': [47.6097, 47.6205, 47.6762],
|
89 |
+
# 'longitude': [-122.3331, -122.3493, -122.3198]
|
90 |
+
# })
|
91 |
+
# elif city == 'Bellevue':
|
92 |
+
# map_data = pd.DataFrame({
|
93 |
+
# 'latitude': [47.6101, 47.6183],
|
94 |
+
# 'longitude': [-122.2015, -122.2046]
|
95 |
+
# })
|
96 |
+
# elif city == 'Algona':
|
97 |
+
# map_data = pd.DataFrame({
|
98 |
+
# 'latitude': [47.3162],
|
99 |
+
# 'longitude': [-122.2295]
|
100 |
+
# })
|
101 |
+
# elif city == 'Auburn':
|
102 |
+
# map_data = pd.DataFrame({
|
103 |
+
# 'latitude': [47.3073],
|
104 |
+
# 'longitude': [-122.2284]
|
105 |
+
# })
|
106 |
+
# elif city == 'Beaux Arts Village':
|
107 |
+
# map_data = pd.DataFrame({
|
108 |
+
# 'latitude': [47.6141],
|
109 |
+
# 'longitude': [-122.2125]
|
110 |
+
# })
|
111 |
+
# elif city == 'Black Diamond':
|
112 |
+
# map_data = pd.DataFrame({
|
113 |
+
# 'latitude': [47.3465],
|
114 |
+
# 'longitude': [-121.9877]
|
115 |
+
# })
|
116 |
+
# elif city == 'Bothell':
|
117 |
+
# map_data = pd.DataFrame({
|
118 |
+
# 'latitude': [47.7595],
|
119 |
+
# 'longitude': [-122.2056]
|
120 |
+
# })
|
121 |
+
# elif city == 'Burien':
|
122 |
+
# map_data = pd.DataFrame({
|
123 |
+
# 'latitude': [47.4702],
|
124 |
+
# 'longitude': [-122.3359]
|
125 |
+
# })
|
126 |
+
# elif city == 'Carnation':
|
127 |
+
# map_data = pd.DataFrame({
|
128 |
+
# 'latitude': [47.6460],
|
129 |
+
# 'longitude': [-121.9758]
|
130 |
+
# })
|
131 |
+
# elif city == 'Clyde Hill':
|
132 |
+
# map_data = pd.DataFrame({
|
133 |
+
# 'latitude': [47.6330],
|
134 |
+
# 'longitude': [-122.2107]
|
135 |
+
# })
|
136 |
+
# elif city == 'Covington':
|
137 |
+
# map_data = pd.DataFrame({
|
138 |
+
# 'latitude': [47.3765],
|
139 |
+
# 'longitude': [-122.0288]
|
140 |
+
# })
|
141 |
+
# elif city == 'Des Moines':
|
142 |
+
# map_data = pd.DataFrame({
|
143 |
+
# 'latitude': [47.3840],
|
144 |
+
# 'longitude': [-122.3061]
|
145 |
+
# })
|
146 |
+
# elif city == 'Duvall':
|
147 |
+
# map_data = pd.DataFrame({
|
148 |
+
# 'latitude': [47.7332],
|
149 |
+
# 'longitude': [-121.9916]
|
150 |
+
# })
|
151 |
+
# elif city == 'Enumclaw':
|
152 |
+
# map_data = pd.DataFrame({
|
153 |
+
# 'latitude': [47.2059],
|
154 |
+
# 'longitude': [-121.9876]
|
155 |
+
# })
|
156 |
+
# elif city == 'Fall City':
|
157 |
+
# map_data = pd.DataFrame({
|
158 |
+
# 'latitude': [47.5980],
|
159 |
+
# 'longitude': [-121.8896]
|
160 |
+
# })
|
161 |
+
# elif city == 'Federal Way':
|
162 |
+
# map_data = pd.DataFrame({
|
163 |
+
# 'latitude': [47.3220],
|
164 |
+
# 'longitude': [-122.3126]
|
165 |
+
# })
|
166 |
+
# elif city == 'Inglewood-Finn Hill':
|
167 |
+
# map_data = pd.DataFrame({
|
168 |
+
# 'latitude': [47.7338],
|
169 |
+
# 'longitude': [-122.2780]
|
170 |
+
# })
|
171 |
+
# elif city == 'Issaquah':
|
172 |
+
# map_data = pd.DataFrame({
|
173 |
+
# 'latitude': [47.5410],
|
174 |
+
# 'longitude': [-122.0311]
|
175 |
+
# })
|
176 |
+
# elif city == 'Kenmore':
|
177 |
+
# map_data = pd.DataFrame({
|
178 |
+
# 'latitude': [47.7557],
|
179 |
+
# 'longitude': [-122.2416]
|
180 |
+
# })
|
181 |
+
# elif city == 'Kent':
|
182 |
+
# map_data = pd.DataFrame({
|
183 |
+
# 'latitude': [47.3809],
|
184 |
+
# 'longitude': [-122.2348]
|
185 |
+
# })
|
186 |
+
# elif city == 'Kirkland':
|
187 |
+
# map_data = pd.DataFrame({
|
188 |
+
# 'latitude': [47.6810],
|
189 |
+
# 'longitude': [-122.2087]
|
190 |
+
# })
|
191 |
+
# elif city == 'Lake Forest Park':
|
192 |
+
# map_data = pd.DataFrame({
|
193 |
+
# 'latitude': [47.7318],
|
194 |
+
# 'longitude': [-122.2764]
|
195 |
+
# })
|
196 |
+
# elif city == 'Maple Valley':
|
197 |
+
# map_data = pd.DataFrame({
|
198 |
+
# 'latitude': [47.3610],
|
199 |
+
# 'longitude': [-122.0240]
|
200 |
+
# })
|
201 |
+
# elif city == 'Medina':
|
202 |
+
# map_data = pd.DataFrame({
|
203 |
+
# 'latitude': [47.6357],
|
204 |
+
# 'longitude': [-122.2169]
|
205 |
+
# })
|
206 |
+
# elif city == 'Mercer Island':
|
207 |
+
# map_data = pd.DataFrame({
|
208 |
+
# 'latitude': [47.5703],
|
209 |
+
# 'longitude': [-122.2264]
|
210 |
+
# })
|
211 |
+
# elif city == 'Milton':
|
212 |
+
# map_data = pd.DataFrame({
|
213 |
+
# 'latitude': [47.2335],
|
214 |
+
# 'longitude': [-122.2730]
|
215 |
+
# })
|
216 |
+
# elif city == 'Newcastle':
|
217 |
+
# map_data = pd.DataFrame({
|
218 |
+
# 'latitude': [47.5477],
|
219 |
+
# 'longitude': [-122.1711]
|
220 |
+
# })
|
221 |
+
# elif city == 'Normandy Park':
|
222 |
+
# map_data = pd.DataFrame({
|
223 |
+
# 'latitude': [47.4051],
|
224 |
+
# 'longitude': [-122.3376]
|
225 |
+
# })
|
226 |
+
# elif city == 'North Bend':
|
227 |
+
# map_data = pd.DataFrame({
|
228 |
+
# 'latitude': [47.4904],
|
229 |
+
# 'longitude': [-121.7852]
|
230 |
+
# })
|
231 |
+
# elif city == 'Pacific':
|
232 |
+
# map_data = pd.DataFrame({
|
233 |
+
# 'latitude': [47.3197],
|
234 |
+
# 'longitude': [-122.2786]
|
235 |
+
# })
|
236 |
+
# elif city == 'Preston':
|
237 |
+
# map_data = pd.DataFrame({
|
238 |
+
# 'latitude': [47.5420],
|
239 |
+
# 'longitude': [-121.9214]
|
240 |
+
# })
|
241 |
+
# elif city == 'Ravensdale':
|
242 |
+
# map_data = pd.DataFrame({
|
243 |
+
# 'latitude': [47.3485],
|
244 |
+
# 'longitude': [-121.9807]
|
245 |
+
# })
|
246 |
+
# elif city == 'Redmond':
|
247 |
+
# map_data = pd.DataFrame({
|
248 |
+
# 'latitude': [47.6734],
|
249 |
+
# 'longitude': [-122.1215]
|
250 |
+
# })
|
251 |
+
# elif city == 'Renton':
|
252 |
+
# map_data = pd.DataFrame({
|
253 |
+
# 'latitude': [47.4829],
|
254 |
+
# 'longitude': [-122.2170]
|
255 |
+
# })
|
256 |
+
# elif city == 'Sammamish':
|
257 |
+
# map_data = pd.DataFrame({
|
258 |
+
# 'latitude': [47.6162],
|
259 |
+
# 'longitude': [-122.0394]
|
260 |
+
# })
|
261 |
+
# elif city == 'SeaTac':
|
262 |
+
# map_data = pd.DataFrame({
|
263 |
+
# 'latitude': [47.4484],
|
264 |
+
# 'longitude': [-122.3085]
|
265 |
+
# })
|
266 |
+
# elif city == 'Shoreline':
|
267 |
+
# map_data = pd.DataFrame({
|
268 |
+
# 'latitude': [47.7554],
|
269 |
+
# 'longitude': [-122.3410]
|
270 |
+
# })
|
271 |
+
# elif city == 'Skykomish':
|
272 |
+
# map_data = pd.DataFrame({
|
273 |
+
# 'latitude': [47.7054],
|
274 |
+
# 'longitude': [-121.4848]
|
275 |
+
# })
|
276 |
+
# elif city == 'Snoqualmie':
|
277 |
+
# map_data = pd.DataFrame({
|
278 |
+
# 'latitude': [47.5410],
|
279 |
+
# 'longitude': [-121.8340]
|
280 |
+
# })
|
281 |
+
# elif city == 'Snoqualmie Pass':
|
282 |
+
# map_data = pd.DataFrame({
|
283 |
+
# 'latitude': [47.4286],
|
284 |
+
# 'longitude': [-121.4420]
|
285 |
+
# })
|
286 |
+
# elif city == 'Tukwila':
|
287 |
+
# map_data = pd.DataFrame({
|
288 |
+
# 'latitude': [47.4835],
|
289 |
+
# 'longitude': [-122.2585]
|
290 |
+
# })
|
291 |
+
# elif city == 'Vashon':
|
292 |
+
# map_data = pd.DataFrame({
|
293 |
+
# 'latitude': [47.4337],
|
294 |
+
# 'longitude': [-122.4660]
|
295 |
+
# })
|
296 |
+
# elif city == 'Woodinville':
|
297 |
+
# map_data = pd.DataFrame({
|
298 |
+
# 'latitude': [47.7524],
|
299 |
+
# 'longitude': [-122.1576]
|
300 |
+
# })
|
301 |
+
# elif city == 'Yarrow Point':
|
302 |
+
# map_data = pd.DataFrame({
|
303 |
+
# 'latitude': [47.6348],
|
304 |
+
# 'longitude': [-122.2218]
|
305 |
+
# })
|
306 |
|
307 |
st.map(map_data, zoom=11)
|