File size: 675 Bytes
a3f6cfb
2c49304
a3f6cfb
2c49304
 
a3f6cfb
2c49304
a3f6cfb
2c49304
 
a3f6cfb
 
2c49304
 
 
 
 
 
 
 
 
 
a3f6cfb
 
2c49304
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
import language_tool_python
import gradio as gr

# Initialize LanguageTool for English
tool = language_tool_python.LanguageTool('en-US')

# Function to correct grammar
def grammar_correction(text):
    matches = tool.check(text)
    corrected_text = language_tool_python.utils.correct(text, matches)
    return corrected_text

# Gradio interface for testing the grammar correction
def main():
    iface = gr.Interface(
        fn=grammar_correction,
        inputs="text",
        outputs="text",
        title="Grammar Correction Tool",
        description="Enter text to correct grammar and spelling errors."
    )
    iface.launch()

if __name__ == "__main__":
    main()