AIEcosystem commited on
Commit
ecc7d1d
·
verified ·
1 Parent(s): fe6dbce

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +15 -2
src/streamlit_app.py CHANGED
@@ -243,7 +243,7 @@ category_mapping = {
243
  def load_ner_model():
244
  """Loads the GLiNER model and caches it."""
245
  try:
246
- return GLiNER.from_pretrained("E3-JSI/gliner-multi-pii-domains-v1", nested_ner=True, num_gen_sequences=2, gen_constraints= labels)
247
  except Exception as e:
248
  st.error(f"Failed to load NER model. Please check your internet connection or model availability: {e}")
249
  st.stop()
@@ -342,7 +342,20 @@ if st.button("Results"):
342
  )
343
  st.plotly_chart(fig_bar)
344
 
345
-
 
 
 
 
 
 
 
 
 
 
 
 
 
346
 
347
  # Download Section
348
  st.divider()
 
243
  def load_ner_model():
244
  """Loads the GLiNER model and caches it."""
245
  try:
246
+ return GLiNER.from_pretrained("knowledgator/gliner-multitask-v1.0", nested_ner=True, num_gen_sequences=2, gen_constraints= labels)
247
  except Exception as e:
248
  st.error(f"Failed to load NER model. Please check your internet connection or model availability: {e}")
249
  st.stop()
 
342
  )
343
  st.plotly_chart(fig_bar)
344
 
345
+ # Most Frequent Entities
346
+ st.subheader("Most Frequent Entities", divider="gray")
347
+ word_counts = df['text'].value_counts().reset_index()
348
+ word_counts.columns = ['Entity', 'Count']
349
+ repeating_entities = word_counts[word_counts['Count'] > 1]
350
+ if not repeating_entities.empty:
351
+ st.dataframe(repeating_entities, use_container_width=True)
352
+ fig_repeating_bar = px.bar(repeating_entities, x='Entity', y='Count', color='Entity')
353
+ fig_repeating_bar.update_layout(xaxis={'categoryorder': 'total descending'},
354
+ paper_bgcolor='#F5F5F5',
355
+ plot_bgcolor='#F5F5F5')
356
+ st.plotly_chart(fig_repeating_bar)
357
+ else:
358
+ st.warning("No entities were found that occur more than once.")
359
 
360
  # Download Section
361
  st.divider()