Zero-Shot Image Classification
Transformers
Safetensors
siglip
vision
basiliskan commited on
Commit
5c6483a
·
verified ·
1 Parent(s): d68ec83

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +1 -1
handler.py CHANGED
@@ -41,7 +41,7 @@ class EndpointHandler:
41
  return features / features.norm(dim=-1, keepdim=True)
42
 
43
  def _get_text_embeddings(self, texts: List[str]) -> torch.Tensor:
44
- inputs = self.processor(text=texts, padding="max_length", return_tensors="pt").to(self.device)
45
  with torch.no_grad():
46
  features = self.model.get_text_features(**inputs)
47
  return features / features.norm(dim=-1, keepdim=True)
 
41
  return features / features.norm(dim=-1, keepdim=True)
42
 
43
  def _get_text_embeddings(self, texts: List[str]) -> torch.Tensor:
44
+ inputs = self.processor(text=texts, padding="max_length", truncation=True, return_tensors="pt").to(self.device)
45
  with torch.no_grad():
46
  features = self.model.get_text_features(**inputs)
47
  return features / features.norm(dim=-1, keepdim=True)