Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
eb69c0e
1
Parent(s):
6c40417
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,12 @@ from geopy.distance import geodesic
|
|
6 |
import googlemaps
|
7 |
from geopy.exc import GeocoderTimedOut
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# Function to apply KNN and return V_oferta values
|
10 |
def knn_predict(df, target_column, features_columns, k=5):
|
11 |
# Separate features and target variable
|
|
|
6 |
import googlemaps
|
7 |
from geopy.exc import GeocoderTimedOut
|
8 |
|
9 |
+
# Function to calculate distance in meters between two coordinates
|
10 |
+
def calculate_distance(lat1, lon1, lat2, lon2):
|
11 |
+
coords_1 = (lat1, lon1)
|
12 |
+
coords_2 = (lat2, lon2)
|
13 |
+
return geodesic(coords_1, coords_2).meters
|
14 |
+
|
15 |
# Function to apply KNN and return V_oferta values
|
16 |
def knn_predict(df, target_column, features_columns, k=5):
|
17 |
# Separate features and target variable
|