Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load your fine-tuned model (ensure it's available in your Hugging Face model repository)
|
5 |
+
corrector = pipeline("text2text-generation", model="Pisethan/spelling-finetuned-model")
|
6 |
+
|
7 |
+
# Define the function for prediction
|
8 |
+
def correct_spelling(text):
|
9 |
+
result = corrector(text)[0]["generated_text"]
|
10 |
+
return result
|
11 |
+
|
12 |
+
# Create a Gradio interface
|
13 |
+
interface = gr.Interface(fn=correct_spelling, inputs="text", outputs="text",
|
14 |
+
title="Khmer Spelling Correction",
|
15 |
+
description="Enter Khmer text to correct spelling errors.")
|
16 |
+
|
17 |
+
# Launch the interface
|
18 |
+
interface.launch()
|