Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
1d5c8f8
1
Parent(s):
57faa99
Update app.py
Browse files
app.py
CHANGED
@@ -255,26 +255,9 @@ predicted_target = knn_predict(filtered_data, 'target_column', ['latitude', 'lon
|
|
255 |
# Add predicted target values to filtered_data
|
256 |
filtered_data['Predicted_target'] = predicted_target
|
257 |
|
258 |
-
# Display the map and filtered_data
|
259 |
-
#with st.container():
|
260 |
-
#st.map(filtered_data, zoom=zoom_level, use_container_width=True)
|
261 |
-
#st.write("Dados:", filtered_data) # Debug: Print filtered_data
|
262 |
-
|
263 |
# Display the map and filtered_data
|
264 |
with st.container():
|
265 |
-
|
266 |
-
|
267 |
-
# Add heatmap layers for 'Valor_Urb', 'Valor_Eqp', and 'RENDA'
|
268 |
-
add_heatmap_layer(folium_map, filtered_data, 'Valor_Urb', 'RdBu_r')
|
269 |
-
add_heatmap_layer(folium_map, filtered_data, 'Valor_Eqp', 'RdBu_r')
|
270 |
-
add_heatmap_layer(folium_map, filtered_data, 'RENDA', 'RdBu_r')
|
271 |
-
|
272 |
-
# Add layer control
|
273 |
-
folium.LayerControl().add_to(folium_map)
|
274 |
-
|
275 |
-
# Display the map using st_folium
|
276 |
-
st_folium(folium_map, height=700, responsive=True)
|
277 |
-
|
278 |
st.write("Dados:", filtered_data) # Debug: Print filtered_data
|
279 |
|
280 |
k_threshold = 5
|
@@ -312,4 +295,17 @@ if 'Predicted_target' in filtered_data.columns and not np.all(predicted_target =
|
|
312 |
st.write(f"Valor médio (Reais/m²) para as características selecionadas: ${mean_value:.2f}$ Reais")
|
313 |
st.write(f"Os valores podem variar entre ${lower_bound:.2f}$ e ${higher_bound:.2f}$ Reais, dependendo das características dos imóveis.")
|
314 |
else:
|
315 |
-
st.warning(f"**Dados insuficientes para inferência do valor. Mínimo necessário:** {k_threshold}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
# Add predicted target values to filtered_data
|
256 |
filtered_data['Predicted_target'] = predicted_target
|
257 |
|
|
|
|
|
|
|
|
|
|
|
258 |
# Display the map and filtered_data
|
259 |
with st.container():
|
260 |
+
st.map(filtered_data, zoom=zoom_level, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
st.write("Dados:", filtered_data) # Debug: Print filtered_data
|
262 |
|
263 |
k_threshold = 5
|
|
|
295 |
st.write(f"Valor médio (Reais/m²) para as características selecionadas: ${mean_value:.2f}$ Reais")
|
296 |
st.write(f"Os valores podem variar entre ${lower_bound:.2f}$ e ${higher_bound:.2f}$ Reais, dependendo das características dos imóveis.")
|
297 |
else:
|
298 |
+
st.warning(f"**Dados insuficientes para inferência do valor. Mínimo necessário:** {k_threshold}")
|
299 |
+
|
300 |
+
folium_map = folium.Map(location=[custom_lat, custom_lon], zoom_start=zoom_level, control_scale=True)
|
301 |
+
|
302 |
+
# Add heatmap layers for 'Valor_Urb', 'Valor_Eqp', and 'RENDA'
|
303 |
+
add_heatmap_layer(folium_map, filtered_data, 'Valor_Urb', 'RdBu_r')
|
304 |
+
add_heatmap_layer(folium_map, filtered_data, 'Valor_Eqp', 'RdBu_r')
|
305 |
+
add_heatmap_layer(folium_map, filtered_data, 'RENDA', 'RdBu_r')
|
306 |
+
|
307 |
+
# Add layer control
|
308 |
+
folium.LayerControl().add_to(folium_map)
|
309 |
+
|
310 |
+
# Display the map using st_folium
|
311 |
+
st_folium(folium_map, width="100%", height="100%")
|