Pisethan commited on
Commit
66e68c2
·
verified ·
1 Parent(s): fbd1d68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the model from Hugging Face Hub
5
+ model = pipeline("text2text-generation", model="Pisethan/avirut-finetuned-model")
6
+
7
+ # Define the function for the demo
8
+ def correct_text(input_text):
9
+ result = model(input_text)
10
+ return result[0]["generated_text"]
11
+
12
+ # Set up the Gradio interface
13
+ interface = gr.Interface(
14
+ fn=correct_text,
15
+ inputs="text",
16
+ outputs="text",
17
+ title="Khmer Grammar Checker",
18
+ description="Corrects grammar errors in Khmer sentences."
19
+ )
20
+
21
+ # Launch the interface
22
+ interface.launch()