Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 3.31 KB

translation.md

File metadata and controls

65 lines (43 loc) · 3.31 KB

Translation

Translation is the task of converting text from one language to another.

For more details about the translation task, check out its dedicated page! You will find examples and related materials.

Recommended models

Explore all available models and find the one that suits you best here.

Using the API

<InferenceSnippet pipeline=translation providersMapping={ {"hf-inference":{"modelId":"facebook/nllb-200-distilled-600M","providerModelId":"facebook/nllb-200-distilled-600M"}} } />

API specification

Request

Headers
authorization string Authentication header in the form 'Bearer: hf_****' when hf_**** is a personal user access token with "Inference Providers" permission. You can generate one from your settings page.
Payload
inputs* string The text to translate.
parameters object
        src_lang string The source language of the text. Required for models that can translate from multiple languages.
        tgt_lang string Target language to translate to. Required for models that can translate to multiple languages.
        clean_up_tokenization_spaces boolean Whether to clean up the potential extra spaces in the text output.
        truncation enum Possible values: do_not_truncate, longest_first, only_first, only_second.
        generate_parameters object Additional parametrization of the text generation algorithm.

Response

| Body | | | :--- | :--- | :--- | | translation_text | string | The translated text. |