"""Corrector de escritura Qué hace: Corrige ortografía y gramática en textos. Para quién: Personas con dislexia o problemas de escritura. Cómo: Pipeline de text2text-generation con un modelo finetuneado para corrección en español.""" import gradio as gr from transformers import pipeline corrector = pipeline("text2text-generation", model="vennify/t5-base-grammar-correction") def corregir_texto(texto): prompt = f"correct: {texto}" resultado = corrector(prompt, max_new_tokens=100)[0]['generated_text'] return resultado iface = gr.Interface( fn=corregir_texto, inputs=gr.Textbox(lines=6, placeholder="Type your text with errors..."), outputs=gr.Textbox(label="Corrected Text"), title="English Grammar Corrector", description="Corrects spelling and grammar in English. Simple and lightweight." ) iface.launch()