yksir commited on
Commit
8926b37
·
verified ·
1 Parent(s): 0a2166b

Update cantonPOS.py

Browse files
Files changed (1) hide show
  1. cantonPOS.py +8 -6
cantonPOS.py CHANGED
@@ -1,13 +1,15 @@
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()
 
 
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)