Generate a prompt from an image
Project description
clip-interrogator
Run Version 2 on Colab, HuggingFace, and Replicate!
Version 1 still available in Colab for comparing different CLIP models
Want to figure out what a good prompt might be to create new images like an existing one? The CLIP Interrogator is here to get you answers!
The CLIP Interrogator is a prompt engineering tool that combines OpenAI's CLIP and Salesforce's BLIP to optimize text prompts to match a given image. Use the resulting prompts with text-to-image models like Stable Diffusion.
Using the library
Create and activate a Python virtual environment
python3 -m venv ci_env
source ci_env/bin/activate
Install with PIP
pip install -e git+https://github.com/openai/CLIP.git@main#egg=clip
pip install -e git+https://github.com/pharmapsychotic/BLIP.git@lib#egg=blip
pip install clip-interrogator
You can then use it in your own scripts
from PIL import Image
from clip_interrogator import CLIPInterrogator, Config
image = Image.open(image_path).convert('RGB')
interrogator = CLIPInterrogator(Config(clip_model_name="ViT-L/14"))
print(interrogator.interrogate(image))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
clip-interrogator-0.1.3.tar.gz
(784.4 kB
view hashes)