agshubhi commited on
Commit
ce521cb
1 Parent(s): b58ec2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
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
- topic_model=BERTopic.load("MaartenGr/BERTopic_Wikipedia")
 
 
 
 
 
 
 
 
 
6
  if text:
7
- results = topic_model(text)
8
- st.json(results)
 
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)