File size: 472 Bytes
2b86d4e
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from transformers import pipeline

def translate_es_to_mapudungun(text_es):
    pipe = pipeline("text2text-generation", model="ebanebssa/es-arn")
    translated_text = pipe(text_es)[0]['generated_text']
    return translated_text

# Example usage (can be commented out or removed)
if __name__ == "__main__":
    text_es = input("Enter text in Spanish: ")
    translated_text = translate_es_to_mapudungun(text_es)
    print("Translated text (Mapudungun):", translated_text)