Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
38a9e29
1
Parent(s):
9a4e238
Update app.py
Browse files
app.py
CHANGED
@@ -63,7 +63,7 @@ data = pd.read_excel('ven_fim_PEDÓ_nov_23.xlsx')
|
|
63 |
# Initialize variables to avoid NameError
|
64 |
selected_coords = 'Direcionada'
|
65 |
radius_visible = True
|
66 |
-
custom_address_initial = '
|
67 |
custom_lat = data['latitude'].median()
|
68 |
custom_lon = data['longitude'].median()
|
69 |
radius_in_meters = 1500
|
@@ -197,10 +197,13 @@ st.markdown(f"""<style>
|
|
197 |
}}
|
198 |
</style>""", unsafe_allow_html=True)
|
199 |
|
|
|
|
|
|
|
200 |
# Check if KNN should be applied
|
201 |
if selected_coords == 'Direcionada' and radius_visible:
|
202 |
# Apply KNN and get predicted V_oferta values
|
203 |
-
predicted_V_oferta = knn_predict(filtered_data, 'V_oferta', ['latitude', 'longitude']) # Update with your features
|
204 |
# Add predicted V_oferta values to filtered_data
|
205 |
filtered_data['Predicted_V_oferta'] = predicted_V_oferta
|
206 |
|
|
|
63 |
# Initialize variables to avoid NameError
|
64 |
selected_coords = 'Direcionada'
|
65 |
radius_visible = True
|
66 |
+
custom_address_initial = 'Centro, Lajeado - RS, Brazil' # Initial custom address
|
67 |
custom_lat = data['latitude'].median()
|
68 |
custom_lon = data['longitude'].median()
|
69 |
radius_in_meters = 1500
|
|
|
197 |
}}
|
198 |
</style>""", unsafe_allow_html=True)
|
199 |
|
200 |
+
# Determine which area feature to use for prediction
|
201 |
+
area_feature = np.where(filtered_data['Apriv'] != 0, 'Apriv', 'Atotal')
|
202 |
+
|
203 |
# Check if KNN should be applied
|
204 |
if selected_coords == 'Direcionada' and radius_visible:
|
205 |
# Apply KNN and get predicted V_oferta values
|
206 |
+
predicted_V_oferta = knn_predict(filtered_data, 'V_oferta', ['latitude', 'longitude', area_feature]) # Update with your features
|
207 |
# Add predicted V_oferta values to filtered_data
|
208 |
filtered_data['Predicted_V_oferta'] = predicted_V_oferta
|
209 |
|