Spaces:
Runtime error
Runtime error
Commit ·
8182e16
1
Parent(s): e3758a0
Update main.py
Browse files
main.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import List
|
|
| 5 |
class Item(BaseModel):
|
| 6 |
name: str
|
| 7 |
image1: bytes
|
|
|
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
|
|
@@ -28,7 +29,7 @@ def predict(Item):
|
|
| 28 |
# encoded_image = model.encode(Image.open(filepath))
|
| 29 |
#image_names = list(glob.glob('./*.jpg'))
|
| 30 |
#print("Images:", len(image_names))
|
| 31 |
-
encoded_image = model.encode(
|
| 32 |
|
| 33 |
# Now we run the clustering algorithm. This function compares images aganist
|
| 34 |
# all other images and returns a list with the pairs that have the highest
|
|
|
|
| 5 |
class Item(BaseModel):
|
| 6 |
name: str
|
| 7 |
image1: bytes
|
| 8 |
+
image2: bytes
|
| 9 |
|
| 10 |
app = FastAPI()
|
| 11 |
|
|
|
|
| 29 |
# encoded_image = model.encode(Image.open(filepath))
|
| 30 |
#image_names = list(glob.glob('./*.jpg'))
|
| 31 |
#print("Images:", len(image_names))
|
| 32 |
+
encoded_image = model.encode([Item.image1, Item.image2]], batch_size=128, convert_to_tensor=True, show_progress_bar=True)
|
| 33 |
|
| 34 |
# Now we run the clustering algorithm. This function compares images aganist
|
| 35 |
# all other images and returns a list with the pairs that have the highest
|