import gradio as gr from gramformer import Gramformer # Initialize the Gramformer model (using default settings for now) gf = Gramformer(models=1, use_gpu=False) def correct_grammar(text): # Correct the input text using Gramformer corrected_sentences = gf.correct(text) return " ".join(corrected_sentences) # Gradio Interface def main(): interface = gr.Interface( fn=correct_grammar, inputs=gr.Textbox(lines=2, placeholder="Enter text here..."), outputs="text", title="Grammar Correction App", description="This app corrects grammar using the Gramformer model. Enter a sentence to correct its grammar.", ) # Launch the Gradio interface interface.launch() if __name__ == "__main__": main()