import gradio as gr from transformers import pipeline def correct_grammar(sentence): model_name = "AventIQ-AI/t5-grammar-correction" generator = pipeline("text2text-generation", model=model_name) result = generator(sentence, max_length=256)[0]['generated_text'] return result iface = gr.Interface( fn=correct_grammar, inputs=gr.Textbox(label="Input Sentence"), outputs=gr.Textbox(label="Corrected Sentence"), title="T5 Grammar Correction", description="Enter a sentence with grammar mistakes, and the model will correct it." ) if __name__ == "__main__": iface.launch()