complaint_mgnt / app.py
agshubhi's picture
Update app.py
ce521cb verified
raw
history blame
599 Bytes
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)