| hf_table_question_answer | R Documentation |
Ask a question in plain language about a data frame, using a table question-answering model (such as TAPAS) via the Hugging Face Inference Providers API. The data frame is converted to the string-cell format the API expects; all values are coerced to character.
hf_table_question_answer(
query,
table,
model = hf_default_model("table_question_answer"),
token = NULL,
endpoint_url = NULL,
...
)
query |
Character vector of question(s) to ask about the table. |
table |
A data frame to query. |
model |
Character string. Model ID from the Hugging Face Hub. Append '":provider"' to select an inference provider. Default: "google/tapas-base-finetuned-wtq". |
token |
Character string or NULL. API token for authentication. |
endpoint_url |
Character string or NULL. A custom Inference Endpoint URL. |
... |
Additional arguments (currently unused). |
A tibble with columns: query, answer, aggregator, cells (a list-column of the source cells the answer was drawn from).
https://huggingface.co/docs/inference-providers/tasks/table-question-answering
## Not run:
sales <- data.frame(
product = c("Widgets", "Gadgets", "Gizmos"),
revenue = c(120, 80, 50)
)
hf_table_question_answer("Which product had the highest revenue?", sales)
hf_table_question_answer("What is the total revenue?", sales)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.