|
import gradio as gr |
|
import os |
|
import zipfile |
|
from zipfile import ZipFile |
|
import shutil |
|
from pathlib import Path |
|
|
|
|
|
os.system("pip install ./language_tool_python-2.7.1-py3-none-any.whl") |
|
|
|
import language_tool_python |
|
|
|
|
|
corrector = language_tool_python.LanguageTool('en-US') |
|
|
|
|
|
def grammar_correction(text): |
|
corrected_text = corrector.correct(text) |
|
return corrected_text |
|
|
|
|
|
iface = gr.Interface(fn=grammar_correction, |
|
inputs="text", |
|
outputs="text", |
|
title="Grammar Correction Tool", |
|
description="Enter text to correct grammatical errors.") |
|
|
|
if __name__ == "__main__": |
|
iface.launch() |
|
|