import os from transformers import pipeline def translate_text(text): token = os.getenv("HF_TOKEN") translator = pipeline( "translation", model="Helsinki-NLP/opus-mt-tr-en", use_auth_token=token ) result = translator(text, max_length=400) return result[0]['translation_text']