hf_caption_image: Caption Images

View source: R/multimodal.R

hf_caption_imageR Documentation

Caption Images

Description

Generate short image captions. This uses a vision-capable chat model by default because the public 'hf-inference' provider did not expose a broadly available image-to-text captioning model during verification.

Usage

hf_caption_image(
  image,
  prompt = "Write a short, factual caption for this image.",
  model = hf_default_model("caption_image"),
  max_tokens = 80,
  token = NULL,
  endpoint_url = NULL,
  ...
)

Arguments

image

Image input: a local file path, URL, raw vector, or vector/list of paths/URLs.

prompt

Prompt used to request the caption.

model

Character string. Vision-capable chat model ID. Default: "google/gemma-3-4b-it".

max_tokens

Integer. Maximum tokens to generate.

token

Character string or NULL. API token for authentication.

endpoint_url

Character string or NULL. A custom Inference Endpoint URL.

...

Additional arguments passed to hf_describe_image().

Value

A tibble with columns: image, caption.

See Also

hf_describe_image

Examples

## Not run: 
hf_caption_image("cat.png")

## End(Not run)

huggingfaceR documentation built on Aug. 30, 2026, 1:06 a.m.