yksir commited on
Commit
a28544c
·
verified ·
1 Parent(s): 050bab7

Create cantonPOS.py

Browse files
Files changed (1) hide show
  1. cantonPOS.py +13 -0
cantonPOS.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the POS model
5
+ model_name = "AlienKevin/bert_base_cantonese_pos_hkcancor"
6
+ nlp = pipeline("ner", model=model_name)
7
+
8
+ def predict(text):
9
+ return nlp(text)
10
+
11
+ # Gradio interface
12
+ demo = gr.Interface(fn=predict, inputs="text", outputs="json")
13
+ demo.launch()