Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -38,14 +38,13 @@ def detect(image):
|
|
38 |
with torch.no_grad():
|
39 |
|
40 |
# Apply transformations to the image and move it to the appropriate device
|
41 |
-
|
42 |
|
43 |
# Extract features using the DinoV2 model
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
model.eval()
|
48 |
|
|
|
49 |
with torch.no_grad():
|
50 |
outputs = model(dino_embedding)
|
51 |
pred_dress_cat = round(torch.argmax(outputs, dim = 1).tolist()[0])
|
|
|
38 |
with torch.no_grad():
|
39 |
|
40 |
# Apply transformations to the image and move it to the appropriate device
|
41 |
+
image_tensor = transform_image(new_im).to(device)
|
42 |
|
43 |
# Extract features using the DinoV2 model
|
44 |
+
dino_embedding = dinov2_vits14(image_tensor.unsqueeze(0)).cpu()
|
45 |
+
dino_numpy = dinov2_vits14(image_tensor.unsqueeze(0)).cpu().numpy()
|
|
|
|
|
46 |
|
47 |
+
|
48 |
with torch.no_grad():
|
49 |
outputs = model(dino_embedding)
|
50 |
pred_dress_cat = round(torch.argmax(outputs, dim = 1).tolist()[0])
|