File size: 663 Bytes
39c00be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

# Load your fine-tuned model (ensure it's available in your Hugging Face model repository)
corrector = pipeline("text2text-generation", model="Pisethan/spelling-finetuned-model")

# Define the function for prediction
def correct_spelling(text):
    result = corrector(text)[0]["generated_text"]
    return result

# Create a Gradio interface
interface = gr.Interface(fn=correct_spelling, inputs="text", outputs="text", 
                         title="Khmer Spelling Correction",
                         description="Enter Khmer text to correct spelling errors.")

# Launch the interface
interface.launch()