siddhantuniyal's picture
Update app.py
59dbede verified
raw
history blame contribute delete
574 Bytes
from transformers import pipeline
import gradio as gr
corrector = pipeline(
'text2text-generation',
'pszemraj/flan-t5-large-grammar-synthesis',
)
def correct(text):
sentences = text.split(".")
output = ""
for sentence in sentences:
sentence += "."
output += corrector(sentence)[0]['generated_text']
return output
iface = gr.Interface(
fn= correct,
inputs= "text",
outputs= "text",
title="Aeravat Grammar Correction",
)
# Launch the Gradio interface
iface.launch(share=True)