import gradio as gr from ginger import correct_sentence # Import the correct_sentence function from ginger.py def grammar_corrector(text): """ This function calls the Ginger API function to correct the text. """ return correct_sentence(text) def main(): # Create the Gradio interface interface = gr.Interface( fn=grammar_corrector, # Function to correct the grammar inputs=gr.Textbox(lines=2, placeholder="Enter a sentence..."), # Input box for sentence outputs=gr.Textbox(label="Corrected Sentence"), # Output box for corrected sentence title="Grammar Correction App", # Title for the app description="Enter a sentence and click 'Submit' to see the corrected version.", # Brief description ) # Launch the interface interface.launch() if __name__ == "__main__": main()