Update app.py
Browse files
app.py
CHANGED
@@ -79,7 +79,7 @@ def compute_clip_embedding(text=None, image=None):
|
|
79 |
Returns:
|
80 |
list: CLIP embedding as a list of floats.
|
81 |
"""
|
82 |
-
inputs = clip_processor(text=text, images=image, return_tensors="pt", padding=True)
|
83 |
outputs = clip_model.get_text_features(**inputs) if text else clip_model.get_image_features(**inputs)
|
84 |
embedding = outputs.detach().cpu().numpy().flatten().tolist()
|
85 |
return embedding
|
|
|
79 |
Returns:
|
80 |
list: CLIP embedding as a list of floats.
|
81 |
"""
|
82 |
+
inputs = clip_processor(text=text, images=image, return_tensors="pt", padding=True).to(device)
|
83 |
outputs = clip_model.get_text_features(**inputs) if text else clip_model.get_image_features(**inputs)
|
84 |
embedding = outputs.detach().cpu().numpy().flatten().tolist()
|
85 |
return embedding
|