Skip to contents

Ask a vision-capable chat model to describe an image.

Usage

hf_describe_image(
  image,
  prompt = "Describe this image.",
  model = hf_default_model("vision_chat"),
  max_tokens = 200,
  token = NULL,
  endpoint_url = NULL,
  ...
)

Arguments

image

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

prompt

Prompt to send with each image. Default: "Describe this image."

model

Character string. Vision-capable chat model ID.

max_tokens

Integer. Maximum tokens to generate. Default: 200.

token

Character string or NULL. API token for authentication.

endpoint_url

Character string or NULL. A custom Inference Endpoint URL.

...

Additional parameters passed to hf_chat().

Value

A tibble with columns: image, description.

Examples

if (FALSE) { # \dontrun{
image <- paste0(
  "https://huggingface.co/datasets/huggingface/",
  "documentation-images/resolve/main/cat.png"
)
hf_describe_image(image)
} # }