hf_ez_translation: Translate between Languages

View source: R/ez.R

hf_ez_translationR Documentation

Translate between Languages

Description

This task is well known to translate text from one language to another

Usage

hf_ez_translation(model_id = "Helsinki-NLP/opus-mt-en-es", use_api = FALSE)

Arguments

model_id

A model_id. Run hf_search_models(...) for model_ids. Defaults to 'Helsinki-NLP/opus-mt-en-es'.

use_api

Whether to use the Inference API to run the model (TRUE) or download and run the model locally (FALSE). Defaults to FALSE

Value

A translation object

See Also

https://huggingface.co/docs/api-inference/detailed_parameters#translation-task

Examples

## Not run: 
# Load the default translation model
ez <- hf_ez_translation()

# Translate from English to Spanish.
ez$infer(string = "My name is Sarah and I live in London")

## End(Not run)

farach/huggingfaceR documentation built on Feb. 4, 2023, 10:31 p.m.