Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("Davlan/bert-base-multilingual-cased-ner-hrl")
|
6 |
+
model = AutoModelForTokenClassification.from_pretrained("Davlan/bert-base-multilingual-cased-ner-hrl")
|
7 |
+
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
8 |
+
|
9 |
+
example = st.text_area("Enter text: ")
|
10 |
+
|
11 |
+
if example:
|
12 |
+
ner_results = nlp(example)
|
13 |
+
st.json(ner_results)
|