Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ from shapely.geometry import Point
|
|
10 |
import geopandas as gpd
|
11 |
from geopandas import GeoDataFrame
|
12 |
|
13 |
-
model = torch.hub.load('facebookresearch/dinov2', 'dinov2_vits14')
|
14 |
model.eval()
|
15 |
|
16 |
metadata = pd.read_csv("metadatav3.csv")
|
@@ -57,7 +57,7 @@ def guess_image(img):
|
|
57 |
img = img.convert('RGB')
|
58 |
print(img)
|
59 |
with torch.no_grad():
|
60 |
-
features = model(transform(img).
|
61 |
distances, neighbors = knn.kneighbors(features.unsqueeze(0))
|
62 |
|
63 |
neighbors = neighbors[0]
|
|
|
10 |
import geopandas as gpd
|
11 |
from geopandas import GeoDataFrame
|
12 |
|
13 |
+
model = torch.hub.load('facebookresearch/dinov2', 'dinov2_vits14')
|
14 |
model.eval()
|
15 |
|
16 |
metadata = pd.read_csv("metadatav3.csv")
|
|
|
57 |
img = img.convert('RGB')
|
58 |
print(img)
|
59 |
with torch.no_grad():
|
60 |
+
features = model(transform(img).unsqueeze(0))[0].cpu()
|
61 |
distances, neighbors = knn.kneighbors(features.unsqueeze(0))
|
62 |
|
63 |
neighbors = neighbors[0]
|