Spaces:
Sleeping
Sleeping
File size: 277 Bytes
b222ec5 |
1 2 3 4 5 6 7 8 9 |
##### Initializes CLIP (from https://github.com/openai/CLIP)
import torch, torchvision, clip
device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device)
encoder_image = model.encode_image
encoder_text = model.encode_text
|