Spaces:
Runtime error
Runtime error
import gradio as gr | |
from happytransformer import HappyTextToText, TTSettings | |
def check_grammar(sentence): | |
happy_tt = HappyTextToText("T5", "leslyarun/grammatical-error-correction") | |
args = TTSettings(num_beams=5, min_length=1) | |
# Add the prefix "grammar: " before each input | |
result = happy_tt.generate_text("grammar: " + sentence, args=args) | |
return result | |
demo = gr.Interface(check_grammar, inputs=['text'], | |
outputs="text", | |
title = "English Grammar Corrector") | |
if __name__ == "__main__": | |
demo.launch(debug=True) |