Spaces:
Sleeping
Sleeping
File size: 641 Bytes
6e38be6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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() |