Current collected state Current
Observed since 20 Oct, 17:35 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A library for comparing text and images using CLIP
Abril is a Python library that makes it easy to compare text and images using OpenAI's CLIP model. It provides a simple interface for calculating similarity scores between text descriptions and images.
# First, install CLIP:
pip install git+https://github.com/openai/CLIP.git
# Then install abril:
pip install abril
from abril import ClipComparer
from PIL import Image
# Initialize the comparer
comparer = ClipComparer()
# Compare a single text with an image
score = comparer.compare_text_with_image(
"a photo of a dog",
"path/to/image.jpg"
)
print(f"Similarity score: {score}")
# Find the best matching text for an image
texts = [
"a photo of a dog",
"a photo of a cat",
"a photo of a car"
]
best_text, score = comparer.find_best_match(texts, "./image.jpg")
print(f"Best match: {best_text} (score: {score})")
MIT License - see LICENSE file for details.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.9 | 24 Dec 2024 | 3 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 17:35 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:0b37abd881597e23a377878f0bddac2baa1a0ff6636724f19fc116c1f689df45