diff --git a/spacy_streamlit/visualizer.py b/spacy_streamlit/visualizer.py index 9567a4e..381f7b1 100644 --- a/spacy_streamlit/visualizer.py +++ b/spacy_streamlit/visualizer.py @@ -186,7 +186,7 @@ def visualize_ner( "When the parameter 'manual' is set to True, the parameter 'doc' must be of type 'list', not 'spacy.tokens.Doc'." ) else: - labels = labels or [ent.label_ for ent in doc.ents] + labels = labels or list({ent.label_ for ent in doc.ents}) if not labels: st.warning("The parameter 'labels' should not be empty or None.")