File size: 770 Bytes
84669bc
d90e4dc
 
116d721
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()