Spaces:
Running
Running
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 |
+
text=st.text_area("Enter customer feedback")
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
|
7 |
+
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
|
8 |
+
|
9 |
+
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
10 |
+
example = "My name is Wolfgang and I live in Berlin"
|
11 |
+
if text:
|
12 |
+
ner_results = nlp(text)
|
13 |
+
st.json(ner_results)
|