Catalog PyPI
PACKAGE EXPLORERView in registry

abril

PyPI

A library for comparing text and images using CLIP

Versions collected1
Direct dependencies3From release 0.1.9
Last observed20 Oct, 17:35 UTC

README

Version 0.1.9 documentation

Abril - Text-Image Comparison 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.

Installation

# First, install CLIP:
pip install git+https://github.com/openai/CLIP.git

# Then install abril:
pip install abril

Usage

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})")

Features

  • Easy-to-use interface for text-image comparison
  • Support for both single and multiple text comparisons
  • Uses CLIP's ViT-B/32 model by default (can be changed)
  • Automatically uses GPU if available for faster processing
  • Handles both file paths and PIL Images flexibly
  • Normalizes features for better comparison
  • Returns scores between 0 and 1 for easy interpretation
  • Built on OpenAI's CLIP model
  • GPU acceleration when available

Requirements

  • Python ≥ 3.7
  • PyTorch ≥ 1.7.1
  • Other dependencies are handled automatically during installation

License

MIT License - see LICENSE file for details.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.924 Dec 20243

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
yourusername/abril

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:35 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:0b37abd881597e23a377878f0bddac2baa1a0ff6636724f19fc116c1f689df45