ComeçarComece gratuitamente

Translating text

You've seen an example of English-to-Spanish translation. Now it's your turn to try it the other way around with Spanish-to-English translation.

pipeline has been loaded for you.

Este exercício faz parte do curso

Introduction to LLMs in Python

Ver Curso

Instruções de exercício

  • Define the pipeline task for Spanish-to-English translation (es_to_en).
  • Translate the spanish_text using the model pipeline.

Exercício interativo prático

Experimente este exercício preenchendo este código de exemplo.

spanish_text = "Este curso sobre LLMs se está poniendo muy interesante"

# Define the pipeline
translator = pipeline(task=____, model="Helsinki-NLP/opus-mt-es-en")

# Translate the Spanish text
translations = ____(____, clean_up_tokenization_spaces=True)

print(translations[0]["translation_text"])
Editar e executar código