Spaces:
Build error
Build error
Download utils/image_processing.py from HimankJ/Eden-Multimodal: direct link, hf CLI and curl.
- Browser
- Download file 378 Bytes
-
https://huggingface.co/spaces/HimankJ/Eden-Multimodal/resolve/main/utils/image_processing.py
- Command line
-
hf download hf://spaces/HimankJ/Eden-Multimodal/utils/image_processing.py
-
curl -L -o image_processing.py https://huggingface.co/spaces/HimankJ/Eden-Multimodal/resolve/main/utils/image_processing.py
378 Bytes
| from PIL import Image | |
| from config import clipprocessor, clipmodel | |
| import torch | |
| def getImageArray(image_path): | |
| image = Image.open(image_path) | |
| return image | |
| def get_clip_embeddings(image_path): | |
| image = clipprocessor(images=Image.open(image_path), return_tensors="pt") | |
| image_features = clipmodel.get_image_features(**image) | |
| return torch.stack([image_features]) |