fschwartzer commited on
Commit
fff8af2
1 Parent(s): fd31ef9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -68,12 +68,16 @@ with st.sidebar:
68
  if radius_visible:
69
  radius_in_meters = st.slider('Selecione raio (em metros)', min_value=100, max_value=5000, value=1000)
70
 
71
- # Filter data based on the radius
72
- if selected_coords == 'Custom':
73
  filtered_data = data[data.apply(lambda x: calculate_distance(x['latitude'], x['longitude'], custom_lat, custom_lon), axis=1) <= radius_in_meters]
74
- filtered_data = filtered_data.dropna() # Drop rows with NaN values
75
- else:
76
- filtered_data = data
 
 
 
 
77
 
78
 
79
  # Add a custom CSS class to the map container
 
68
  if radius_visible:
69
  radius_in_meters = st.slider('Selecione raio (em metros)', min_value=100, max_value=5000, value=1000)
70
 
71
+ if selected_coords == 'Custom' and radius_visible:
72
+ # Filter data based on the radius and drop NaN values
73
  filtered_data = data[data.apply(lambda x: calculate_distance(x['latitude'], x['longitude'], custom_lat, custom_lon), axis=1) <= radius_in_meters]
74
+ filtered_data = filtered_data.dropna()
75
+
76
+ # Apply KNN and get predicted Vunit values
77
+ predicted_vunit = knn_predict(filtered_data, 'Vunit', knn_features)
78
+
79
+ # Add predicted Vunit values to filtered_data
80
+ filtered_data['Predicted_Vunit'] = predicted_vunit
81
 
82
 
83
  # Add a custom CSS class to the map container