test5 / app.py
accplan
test
5ba1e8a
raw
history blame
377 Bytes
import gradio as gr
from happytransformer import HappyTextToText, TTSettings
happy_tt = HappyTextToText("T5", "vennify/t5-base-grammar-correction")
args = TTSettings(num_beams=5, min_length=1)
def fix(bad):
result = happy_tt.generate_text("grammar: " + bad, args=args)
return result
iface = gr.Interface(fn=fix, inputs="text", outputs="text")
iface.launch()