dpstudy's picture
Upload 2 files
1a1206e verified
raw
history blame contribute delete
540 Bytes
import gradio as gr
from transformers import pipeline
corrector = pipeline(task="text2text-generation", model="pszemraj/flan-t5-large-grammar-synthesis")
def grammar_corrector(sentence):
result = corrector(sentence)
return result[0]['generated_text']
interface = gr.Interface(fn=grammar_corrector, inputs=gr.Textbox(placeholder= "Type or paste your sentence", lines = 2, max_lines=5), outputs=gr.Textbox(lines = 3),
title="Grammar Suggestion App")
interface.launch(server_name="0.0.0.0", server_port=7860)