Spaces:
Running
Running
File size: 599 Bytes
b58ec2e c38bb7a ce521cb ca447e9 b58ec2e ce521cb b58ec2e ce521cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import streamlit as st
from bertopic import BERTopic
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
text=st.text_area("Enter customer feedback")
tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
# topic_model=BERTopic.load("MaartenGr/BERTopic_Wikipedia")
# if text:
# results = topic_model(text)
# st.json(results)
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
if text:
ner_results = nlp(text)
st.json(ner_results)
|