Add image-only detailed promptor node

This commit is contained in:
dinlo
2026-10-11 14:06:57 +08:00
commit 61f946f9f7
7 changed files with 384 additions and 0 deletions
+109
View File
@@ -0,0 +1,109 @@
# ComfyUI Image Promptor
Image-only ComfyUI node that sends one or more `IMAGE` inputs to a vision-language model and returns a detailed still-image generation prompt as `STRING`.
This package is separate from `Comfyui-Minimax-H3-Promptor`, so the existing MiniMax H3 video nodes are unchanged.
## Node
Search for **Detailed Image Promptor** under `image/Prompting`.
Inputs:
- `image`: one image or an image batch.
- `provider`: `ollama`, `openai_compatible`, `gemini`, or `claude`.
- `model`, `api_base`, `api_key`: provider settings.
- `temperature`, `max_tokens`: generation controls.
- `additional_instruction`: optional image-only focus, such as emphasizing clothing or hand placement.
Output:
- `prompt`: a single English prompt containing the scene, people, poses, actions, relationships, clothing, objects, environment, composition, camera, lighting, color, text, and visual finish when visible.
The node does not expose or analyze video and does not add temporal instructions to the result.
## Local Ollama
Install a vision model in Ollama, for example:
```text
ollama pull qwen2.5vl:7b
```
Use the defaults shown in the node: `http://127.0.0.1:11434` and `SetneufPT/Gemma4-12B-IT-QAT_Q4_64K_16GB-GPU:latest`.
## API providers
For OpenAI-compatible, Gemini, or Claude, enter the API base, model, and key in the node or create `config.json` beside `nodes.py` using `config.example.json` as a template. The node UI values override config values.
Restart ComfyUI after installing or changing the node package. Existing video nodes from the source repository are not modified.
## Установка на русском языке
1. Откройте каталог `custom_nodes` вашей установки ComfyUI.
2. Клонируйте репозиторий:
```bash
cd ComfyUI/custom_nodes
git clone http://192.168.1.171:3000/dimon/ComfyUI-Image-Promptor.git
```
3. Установите зависимости в то же Python-окружение, из которого запускается ComfyUI:
```bash
cd ComfyUI-Image-Promptor
python -m pip install -r requirements.txt
```
В Windows ComfyUI Desktop при необходимости используйте `C:\path\to\ComfyUI\.venv\Scripts\python.exe` вместо системного `python`.
4. Полностью перезапустите ComfyUI.
5. Добавьте **Detailed Image Promptor** из категории `image/Prompting`.
### Зависимости
- `requests>=2.28.0` — HTTP-запросы к выбранному провайдеру.
- `Pillow>=9.0.0` — конвертация тензоров ComfyUI в JPEG.
- `torch` — нужен для тензора `IMAGE`, но обычно уже установлен вместе с ComfyUI. Отдельно устанавливать PyTorch не нужно, если этого не требует ваша установка.
### Ollama
По умолчанию нода использует `http://127.0.0.1:11434` и vision-модель `SetneufPT/Gemma4-12B-IT-QAT_Q4_64K_16GB-GPU:latest`. Ollama должен быть запущен, а модель должна поддерживать изображения. Модель и URL можно изменить прямо в ноде. Для другого vision-моделя, например `qwen2.5vl:7b`, укажите его имя в поле `model`.
Для провайдеров `openai_compatible`, `gemini` и `claude` укажите URL API, модель и ключ в ноде. `config.example.json` можно скопировать в `config.json`; реальные ключи нельзя добавлять в git.
## Installation in English
1. Open the `custom_nodes` directory of your ComfyUI installation.
2. Clone the repository:
```bash
cd ComfyUI/custom_nodes
git clone http://192.168.1.171:3000/dimon/ComfyUI-Image-Promptor.git
```
3. Install dependencies into the same Python environment used by ComfyUI:
```bash
cd ComfyUI-Image-Promptor
python -m pip install -r requirements.txt
```
On Windows ComfyUI Desktop, use `C:\path\to\ComfyUI\.venv\Scripts\python.exe` instead of the system `python` when needed.
4. Restart ComfyUI completely.
5. Add **Detailed Image Promptor** from `image/Prompting`.
### Dependencies
- `requests>=2.28.0` for provider HTTP requests.
- `Pillow>=9.0.0` for converting ComfyUI tensors to JPEG.
- `torch` is needed for the `IMAGE` tensor and is normally supplied by ComfyUI. Do not install a separate PyTorch build unless your ComfyUI setup requires it.
### Ollama
The default endpoint is `http://127.0.0.1:11434` and the default vision model is `SetneufPT/Gemma4-12B-IT-QAT_Q4_64K_16GB-GPU:latest`. Ollama must be running and the selected model must support image input. You can change the model and endpoint directly in the node. For another vision model, such as `qwen2.5vl:7b`, enter its name in `model`.
For `openai_compatible`, `gemini`, or `claude`, enter the provider URL, model, and API key in the node. You may copy `config.example.json` to `config.json` for file-based defaults. Never commit real API keys.
## Лицензия / License
MIT. See `LICENSE`.