Hugging Face
Models
Datasets
Spaces
Buckets
new
Docs
Enterprise
Pricing
Website
Tasks
HuggingChat
Collections
Languages
Organizations
Community
Blog
Posts
Daily Papers
Learn
Discord
Forum
GitHub
Solutions
Team & Enterprise
Hugging Face PRO
Enterprise Support
Inference Providers
Inference Endpoints
Storage Buckets
Log In
Sign Up
Spaces:
vinid
/
webplip
like
34
Running
App
Files
Files
Community
12
Fetching metadata from the HF Docker repository...
refs/pr/3
webplip
/
plip_support.py
vinid
Upload plip_support.py
21847fd
about 3 years ago
raw
Copy download link
history
blame
187 Bytes
import
clip
import
torch
def
embed_text
(
plip, text, device=
"cpu"
):
idx = clip.tokenize([text], truncate=
True
).to(device)
return
plip.encode_text(idx).detach().cpu().numpy()[
0
]