traductor-mapudungun / generate_translation.py
hernanlira's picture
update model
2d19f05
raw
history blame
485 Bytes
from transformers import pipeline
def translate_es_to_mapudungun(text_es):
pipe = pipeline("text2text-generation", model="inria-chile/translator_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)