AIEcosystem commited on
Commit
ec30e66
·
verified ·
1 Parent(s): 37e81ed

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +4 -4
src/streamlit_app.py CHANGED
@@ -21,7 +21,7 @@ st.link_button("by nlpblogs", "https://nlpblogs.com", type="tertiary")
21
  st.markdown(':rainbow[**Supported Languages: English**]')
22
 
23
  expander = st.expander("**Important notes**")
24
- expander.write("""**Named Entities:** This DataHarvest web app predicts ten (10) labels: "person", "country", "city", "organization", "date", "time", "percent, "cardinal", "money", "position"
25
 
26
  Results are presented in easy-to-read tables, visualized in an interactive tree map, pie chart and bar chart, and are available for download along with a Glossary of tags.
27
 
@@ -59,7 +59,7 @@ if not comet_initialized:
59
 
60
  # --- Label Definitions ---
61
 
62
- labels = ["person", "country", "city", "organization", "date", "time", "percent", "cardinal", "money", "position"]
63
 
64
  # Corrected mapping dictionary
65
  # Create a mapping dictionary for labels to categories
@@ -67,7 +67,7 @@ category_mapping = {
67
  "People": ["person", "organization", "position"],
68
  "Locations": ["country", "city"],
69
  "Time": ["date", "time"],
70
- "Numbers": ["money", "percent", "cardinal"]
71
  }
72
 
73
  # --- Model Loading ---
@@ -75,7 +75,7 @@ category_mapping = {
75
  def load_ner_model():
76
  """Loads the GLiNER model and caches it."""
77
  try:
78
- return GLiNER.from_pretrained("gliner-community/gliner_large-v2.5", nested_ner=True, num_gen_sequences=2, gen_constraints= labels)
79
  except Exception as e:
80
  st.error(f"Failed to load NER model. Please check your internet connection or model availability: {e}")
81
  st.stop()
 
21
  st.markdown(':rainbow[**Supported Languages: English**]')
22
 
23
  expander = st.expander("**Important notes**")
24
+ expander.write("""**Named Entities:** This DataHarvest web app predicts nine (9) labels: "person", "country", "city", "organization", "date", "time", "cardinal", "money", "position"
25
 
26
  Results are presented in easy-to-read tables, visualized in an interactive tree map, pie chart and bar chart, and are available for download along with a Glossary of tags.
27
 
 
59
 
60
  # --- Label Definitions ---
61
 
62
+ labels = ["person", "country", "city", "organization", "date", "time", "cardinal", "money", "position"]
63
 
64
  # Corrected mapping dictionary
65
  # Create a mapping dictionary for labels to categories
 
67
  "People": ["person", "organization", "position"],
68
  "Locations": ["country", "city"],
69
  "Time": ["date", "time"],
70
+ "Numbers": ["money", "cardinal"]
71
  }
72
 
73
  # --- Model Loading ---
 
75
  def load_ner_model():
76
  """Loads the GLiNER model and caches it."""
77
  try:
78
+ return GLiNER.from_pretrained("knowledgator/gliner-multitask-large-v0.5", nested_ner=True, num_gen_sequences=2, gen_constraints= labels)
79
  except Exception as e:
80
  st.error(f"Failed to load NER model. Please check your internet connection or model availability: {e}")
81
  st.stop()