Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,20 @@
|
|
1 |
import streamlit as st
|
2 |
from bertopic import BERTopic
|
|
|
|
|
|
|
3 |
|
4 |
text=st.text_area("Enter customer feedback")
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
if text:
|
7 |
-
|
8 |
-
st.json(
|
|
|
1 |
import streamlit as st
|
2 |
from bertopic import BERTopic
|
3 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
|
7 |
text=st.text_area("Enter customer feedback")
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
|
9 |
+
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
|
10 |
+
|
11 |
+
# topic_model=BERTopic.load("MaartenGr/BERTopic_Wikipedia")
|
12 |
+
# if text:
|
13 |
+
# results = topic_model(text)
|
14 |
+
# st.json(results)
|
15 |
+
|
16 |
+
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
17 |
+
|
18 |
if text:
|
19 |
+
ner_results = nlp(text)
|
20 |
+
st.json(ner_results)
|