Spaces:
Sleeping
Sleeping
yeshpanovrustem
commited on
Commit
β’
07d1047
1
Parent(s):
051d08c
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,21 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
3 |
-
st.
|
4 |
-
#
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
+
# use @st.cache decorator to cache model β because it is too large, we do not want to reload it every time
|
6 |
+
# use allow_output_mutation = True to tell streamlit that model should be treated as immutable object β singleton
|
7 |
+
@st.cache(allow_output_mutation = True)
|
8 |
|
9 |
+
# load model and tokenizer
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained("yeshpanovrustem/xlm-roberta-large-ner-kazakh")
|
11 |
+
model = AutoModelForTokenClassification.from_pretrained("yeshpanovrustem/xlm-roberta-large-ner-kazakh")
|
12 |
+
|
13 |
+
# # define function for ner
|
14 |
+
|
15 |
+
|
16 |
+
# st.markdown("# Hello")
|
17 |
+
# # st.set_page_config(page_title = "Kazakh Named Entity Recognition", page_icon = "π")
|
18 |
+
# # st.title("π Kazakh Named Entity Recognition")
|
19 |
+
|
20 |
+
# x = st.slider('Select a value')
|
21 |
+
# st.write(x, 'squared is', x * x)
|