File size: 571 Bytes
66e68c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()