import gradio as gr import os import zipfile from zipfile import ZipFile import shutil from pathlib import Path # Install language_tool_python from local .whl file os.system("pip install ./language_tool_python-2.7.1-py3-none-any.whl") import language_tool_python # Initialize the grammar corrector corrector = language_tool_python.LanguageTool('en-US') # Define the correction function def grammar_correction(text): corrected_text = corrector.correct(text) return corrected_text # Create Gradio UI 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()