Looking for a good question to create new images similar to an existing one? Use PixelForge.
Install all dependencies:
pip install -r requirements.txt
You can now use it in your script.
from PIL import Image
from pixel_forge import PixelForge, Config
clip_model_name = "ViT-L-14/openai"
image_path = "your image path"
image = Image.open(image_path).convert("RGB")
px = PixelForge(Config(clip_model_name=clip_model_name))
print(px.interrogate(image)) # best image prompt
The Config
object lets you configure CLIP Interrogator's processing.
clip_model_name
: which of the OpenCLIP pretrained CLIP models to usecache_path
: path where to save precomputed text embeddingsdownload_cache
: when True will download the precomputed embeddings from huggingfacechunk_size
: batch size for CLIP, use smaller for lower VRAM