Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,8 +17,9 @@ with torch.no_grad():
|
|
| 17 |
attribute_embeddings = model.encode_text(clip.tokenize(attributes).to(device))
|
| 18 |
|
| 19 |
def predict_apparel_and_attributes(image):
|
| 20 |
-
|
| 21 |
-
image_input = preprocess(
|
|
|
|
| 22 |
with torch.no_grad():
|
| 23 |
image_embedding = model.encode_image(image_input)
|
| 24 |
|
|
|
|
| 17 |
attribute_embeddings = model.encode_text(clip.tokenize(attributes).to(device))
|
| 18 |
|
| 19 |
def predict_apparel_and_attributes(image):
|
| 20 |
+
pil_image = Image.fromarray((image * 255).astype(np.uint8))
|
| 21 |
+
image_input = preprocess(pil_image).unsqueeze(0).to(device)
|
| 22 |
+
|
| 23 |
with torch.no_grad():
|
| 24 |
image_embedding = model.encode_image(image_input)
|
| 25 |
|