from transformers import pipeline | |
# Cargar un modelo pre-entrenado de generación de texto GPT-2 | |
generator = pipeline('text-generation', model='gpt2') | |
# Generar texto con el modelo pre-entrenado | |
generated_text = generator("Once upon a time, in a land far, far away", max_length=100, num_return_sequences=1) | |
print(generated_text) | |