Update cantonPOS.py
Browse files- cantonPOS.py +8 -6
cantonPOS.py
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
-
import
|
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 |
-
|
9 |
-
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
1 |
+
import streamlit as st
|
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 |
+
# Streamlit interface
|
9 |
+
st.title("Cantonese POS Tagging App")
|
10 |
+
input_text = st.text_area("Enter Cantonese text:")
|
11 |
|
12 |
+
if st.button("Tag POS"):
|
13 |
+
if input_text:
|
14 |
+
results = nlp(input_text)
|
15 |
+
st.json(results)
|