import gradio as gr from transformers import pipeline # Load the model from Hugging Face Hub model = pipeline("text2text-generation", model="Pisethan/avirut-finetuned-model") # Define the function for the demo def correct_text(input_text): result = model(input_text) return result[0]["generated_text"] # Set up the Gradio interface interface = gr.Interface( fn=correct_text, inputs="text", outputs="text", title="Khmer Grammar Checker", description="Corrects grammar errors in Khmer sentences." ) # Launch the interface interface.launch()