Visual Query Template
Ask your image questions, get a prompt back — the node that turns one portrait into a character sheet
- images
- STRING
Visual Query Template is a visual question answering (VQA) node: you feed it an image, hand it a question template, and it answers each question and stitches the answers back into one string. The name is a mouthful, but the pitch is genuinely handy for one specific job - turning a single reference image into a structured character description you can drop into a prompt, a LoRA dataset caption, or a character-sheet workflow.
The default question field tells you exactly who this is for: {eye color} eyes, {hair style} {hair color} hair, {ethnicity} {gender}, {age number} years old, {facialhair}. That's not a captioning tool's vocabulary, that's a character-consistency checklist. If you've ever had one good portrait of an OC and needed a text description to seed generations or caption training images, this is the niche it fills. If you instead want free-form "describe this scene" captions, grab a proper captioner or WD14 tagger - this node answers questions, not "what's going on here".
How it works
The source is a single ~70-line file, which is a good sign for something this small. Under the hood it calls Hugging Face's transformers pipeline for VQA. Each run, it loads the chosen model (device = 0 if CUDA else -1, so GPU when you have one), then for every image in your batch it does the same dance:
- Converts the image tensor to PIL.
- Finds every
{placeholder}in your question. - Asks the model each placeholder as its own question -
{eye color}literally sends"eye color"as a question - and takes the top answer. - Replaces the placeholder in the template, and returns one finished string per image.
That's the mechanism to remember: one placeholder = one forward pass per image. Six slots in your template means six VQA calls per image. Fine on a GPU, slow as treacle on CPU. It also rebuilds the pipeline from scratch every execution - the weights are cached after the first run so there's no re-download, but don't put this node inside a per-frame loop and expect speed.
The inputs that matter
- images (IMAGE) - a batch of tensors, so wire in a Load Image or anything that outputs an image.
- model - pick from four real Hugging Face VQA models:
Salesforce/blip-vqa-base(the sensible default),blip-vqa-capfilt-large,dandelin/vilt-b32-finetuned-vqa, ormicrosoft/git-large-vqav2. GIT-large is the most accurate and the heaviest; VILT sits in the middle; BLIP base is small and fast. - question (STRING, multiline) - your template with
{placeholders}. The craft is in phrasing them as fill-in-the-blank questions (hair style,age number), because VQA models answer short, single-token-ish answers. A placeholder likedescribe this personwill return noise.
It outputs a STRING list - one completed template per input image - which wires straight into any text input: a Show Text node, a prompt concatenator, or a CLIP text encode if you're auto-building prompts.
Installing it
ComfyUI Manager (search "VisualQueryTemplate"), or the usual manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/celoron/ComfyUI-VisualQueryTemplate
# restart ComfyUI
The requirements.txt pins torch, numpy, transformers - you already have torch and numpy; transformers is the one real dependency Manager will install for you. The hidden cost is the model: the first run downloads your pick from Hugging Face, and GIT-large is over a gigabyte, so give it internet and a minute.
Honest notes
This is an obscure pack - effectively zero impressions on comfy.icu, and the author's own r/comfyui announcement post got no replies. That's not a red flag by itself: the code is short and readable, it makes no API calls and needs no key, and it runs entirely locally after the one-time model download. But you're not getting an active maintenance track either. Treat it as a small utility you can verify yourself, which is easy since the whole thing is one file. If you want stronger structured description and don't mind a bigger footprint, modern vision-LLM nodes will run circles around 2021-era VQA models - but for cheap, offline, slot-filling description this still does the job with zero setup drama.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| model | COMBO | 4 options: Salesforce/blip-vqa-base, Salesforce/blip-vqa-capfilt-large, dandelin/vilt-b32-finetuned-vqa, microsoft/git-large-vqav2 | |
| question | STRING | {eye color} eyes, {hair style} {hair color} hair, {ethnicity} {gender}, {age number} years old, {facialhair} | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |