| hf_text_to_image | R Documentation |
Generate an image from a prompt and write it to disk using a text-to-image model via the Hugging Face Inference Providers API.
hf_text_to_image(
prompt,
output = NULL,
seed = NULL,
model = hf_default_model("text_to_image"),
token = NULL,
endpoint_url = NULL,
overwrite = FALSE,
...
)
prompt |
Character vector of prompts. |
output |
Character path(s) or NULL. When NULL, files are written to temporary paths with an extension inferred from the response content type. |
seed |
Integer or NULL. Optional random seed for reproducibility when the provider/model supports it. |
model |
Character string. Model ID from Hugging Face Hub. Default: "black-forest-labs/FLUX.1-schnell". |
token |
Character string or NULL. API token for authentication. |
endpoint_url |
Character string or NULL. A custom Inference Endpoint URL. |
overwrite |
Logical. If TRUE, overwrite existing output files. |
... |
Additional generation parameters passed to the model. |
A tibble with columns: prompt, path, content_type, image.
https://huggingface.co/docs/inference-providers/tasks/text-to-image
## Not run:
img <- hf_text_to_image("a small red cube on a white background", seed = 42)
img$path
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.