yeshpanovrustem commited on
Commit
07d1047
β€’
1 Parent(s): 051d08c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -1,8 +1,21 @@
1
  import streamlit as st
 
 
2
 
3
- st.markdown("# Hello")
4
- # st.set_page_config(page_title = "Kazakh Named Entity Recognition", page_icon = "πŸ”")
5
- # st.title("πŸ” Kazakh Named Entity Recognition")
6
 
7
- x = st.slider('Select a value')
8
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
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)