Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load model
|
5 |
+
classifier = pipeline("text-classification", model="Pisethan/khmer-classifier")
|
6 |
+
|
7 |
+
def predict(text):
|
8 |
+
output = classifier(text)[0]
|
9 |
+
return f"📚 Label: {output['label']} (Score: {output['score']:.2f})"
|
10 |
+
|
11 |
+
demo = gr.Interface(fn=predict, inputs="text", outputs="text", title="Khmer Prompt Classifier")
|
12 |
+
demo.launch()
|