Skip to content

Commit b57523f

Browse files
committed
Integrated embedding logic to the process/upload video pipeline
1 parent 16a2473 commit b57523f

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

backend/embeddings/embedder.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,4 @@ def _generate_clip_embedding(self, frames, num_frames: int = 8) -> torch.Tensor:
5555

5656

5757
return video_embedding.cpu()
58-
59-
60-
def generate_clip_text_embedding(self, text: str) -> np.ndarray:
61-
"""
62-
Generate a normalized text embedding using the Open AI CLIP Model.
63-
64-
Args:
65-
text (str): The input text string.
66-
67-
Returns:
68-
torch.Tensor: A normalized embedding tensor for the input text.
69-
"""
70-
model, processor = self._get_clip_model()
71-
72-
inputs = processor(text=[text], return_tensors="pt", padding=True).to(self._device)
73-
74-
with torch.no_grad():
75-
text_features = model.get_text_features(**inputs)
76-
text_features = text_features / text_features.norm(p=2, dim=-1, keepdim=True)
77-
78-
print(f"Generated CLIP embedding for text: {text[:30]}...")
79-
80-
return text_features.cpu().numpy()
81-
82-
83-
8458

0 commit comments

Comments
 (0)