Spaces:
Runtime error
Runtime error
Commit
·
526a687
1
Parent(s):
a7331e7
Update main.py
Browse files
main.py
CHANGED
|
@@ -33,9 +33,10 @@ def predict(item: Item):
|
|
| 33 |
#image_names = list(glob.glob('./*.jpg'))
|
| 34 |
#print("Images:", len(image_names))
|
| 35 |
|
| 36 |
-
|
|
|
|
| 37 |
|
| 38 |
-
encoded_image = model.encode([Image.open(
|
| 39 |
|
| 40 |
# Now we run the clustering algorithm. This function compares images aganist
|
| 41 |
# all other images and returns a list with the pairs that have the highest
|
|
|
|
| 33 |
#image_names = list(glob.glob('./*.jpg'))
|
| 34 |
#print("Images:", len(image_names))
|
| 35 |
|
| 36 |
+
image_stream1 = io.BytesIO(item.image1);
|
| 37 |
+
image_stream2 = io.BytesIO(item.image2);
|
| 38 |
|
| 39 |
+
encoded_image = model.encode([Image.open(image_stream1), Image.open(image_stream2)], batch_size=128, convert_to_tensor=True, show_progress_bar=True)
|
| 40 |
|
| 41 |
# Now we run the clustering algorithm. This function compares images aganist
|
| 42 |
# all other images and returns a list with the pairs that have the highest
|