# Hugging Face

> Run inference on open models hosted on the Hugging Face Inference API.

App · AI Models · 1 action. Web page: https://docs.lodol.com/docs/integrations/huggingface

## Actions

### Query a model

Run inference on a model served by Hugging Face's serverless Inference API. Give the model's repository id and the text to send; the action returns the model's output. Works across tasks such as summarization, classification, translation, and feature extraction (embeddings).

**Inputs**

- Model (`model`, text, required): The Hugging Face model repository id to run, e.g. 'facebook/bart-large-cnn'. The model must be served by the hf-inference provider (Hugging Face's serverless inference) - its model page shows an 'HF Inference' provider when it is.
- Inputs (`inputs`, text, required): The text to send to the model - a prompt to continue, a passage to summarize or translate, a sentence to classify, and so on.
- Parameters (`parameters`, object): Optional task-specific parameters passed straight to the model, e.g. {"max_length": 130, "min_length": 30} for summarization. Leave empty for the model's defaults.
- Wait for model to load (`wait_for_model`, true/false): Serverless models are loaded on demand. When enabled, the request waits for a cold model to finish loading instead of failing; disable to return immediately. Default: `true`.

**Outputs**

- `generated_text` (text): The model's primary text output, for text-producing tasks (summarization, translation, generation). Null for tasks that don't produce text (see 'result').
- `model` (text): The model repository id that was queried.
- `result`: The raw model output. Its shape depends on the model's task: a list of summaries for summarization, nested label/score lists for classification, and so on.

**Example output**

```json
{
  "generated_text": "Hugging Face builds tools for machine learning and hosts open models.",
  "model": "facebook/bart-large-cnn",
  "result": [
    {
      "summary_text": "Hugging Face builds tools for machine learning and hosts open models."
    }
  ]
}
```
