Skip to main content

Generate a prompt from an image

Project description

clip-interrogator

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!

Run it!

Run Version 2 on Colab, HuggingFace, and Replicate!

Open In Colab Generic badge Replicate


Version 1 still available in Colab for comparing different CLIP models

Open In Colab

About

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 on DreamStudio to create cool art!.

Using as a 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 script

from PIL import Image
from clip_interrogator import Interrogator, Config
image = Image.open(image_path).convert('RGB')
ci = Interrogator(Config(clip_model_name="ViT-L/14"))
print(ci.interrogate(image))

Project details


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.4.tar.gz (784.9 kB view details)

Uploaded Source

File details

Details for the file clip-interrogator-0.1.4.tar.gz.

File metadata

  • Download URL: clip-interrogator-0.1.4.tar.gz
  • Upload date:
  • Size: 784.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for clip-interrogator-0.1.4.tar.gz
Algorithm Hash digest
SHA256 36cee521edcee65cc27cd6cc855d5d264e7766b0f3aebcc8cd1bfe34842edad9
MD5 cc80b5605b64ad48a025458001570b4f
BLAKE2b-256 ad86d41a20d5092306e1cf18a22cb8d51e9313e025e231e7c6cee6c8c0969aac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page