Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,15 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
x = st.slider('Select a value')
|
4 |
-
st.write(x, 'squared is', x * x)
|
|
|
1 |
import streamlit as st
|
2 |
+
import transformers
|
3 |
+
from transformers import pipeline, TokenClassificationPipeline, BertForTokenClassification , AutoTokenizer
|
4 |
+
|
5 |
+
#model.to("cpu")
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained("dmis-lab/biobert-large-cased-v1.1", truncation = True, padding=True, model_max_length=512,)
|
7 |
+
model_checkpoint = BertForTokenClassification.from_pretrained("dexay/Ner2HgF", )
|
8 |
+
token_classifier = pipeline("token-classification", tokenizer = tokenizer,model=model_checkpoint, )
|
9 |
+
|
10 |
+
x = st.text('enter text')
|
11 |
+
|
12 |
+
if text:
|
13 |
+
out = token_classifier(x)
|
14 |
+
st.json(out)
|
15 |
|
|
|
|