AIEcosystem commited on
Commit
6016ab7
·
verified ·
1 Parent(s): 6ff1fb4

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 nine (9) labels: "person", "country", "city", "organization", "date", "time", "money", "percent", "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
 
@@ -58,7 +58,7 @@ if not comet_initialized:
58
  st.warning("Comet ML not initialized. Check environment variables.")
59
 
60
  # --- Label Definitions ---
61
- labels = ["person", "country", "city", "organization", "date", "time", "money", "percent", "position"]
62
 
63
  # Corrected mapping dictionary
64
  # Create a mapping dictionary for labels to categories
@@ -66,7 +66,7 @@ category_mapping = {
66
  "People": ["person", "organization", "position"],
67
  "Locations": ["country", "city"],
68
  "Time": ["date", "time"],
69
- "Numbers": ["money", "percent"]
70
  }
71
 
72
  # --- Model Loading ---
@@ -74,7 +74,7 @@ category_mapping = {
74
  def load_ner_model():
75
  """Loads the GLiNER model and caches it."""
76
  try:
77
- return GLiNER.from_pretrained("knowledgator/gliner-multitask-large-v0.5", nested_ner=True, num_gen_sequences=2, gen_constraints= labels)
78
  except Exception as e:
79
  st.error(f"Failed to load NER model. Please check your internet connection or model availability: {e}")
80
  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 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
 
 
58
  st.warning("Comet ML not initialized. Check environment variables.")
59
 
60
  # --- Label Definitions ---
61
+ labels = ["person", "country", "city", "organization", "date", "time", "percent, "cardinal", "money", "position"]
62
 
63
  # Corrected mapping dictionary
64
  # Create a mapping dictionary for labels to categories
 
66
  "People": ["person", "organization", "position"],
67
  "Locations": ["country", "city"],
68
  "Time": ["date", "time"],
69
+ "Numbers": ["money", "percent", "cardinal"]
70
  }
71
 
72
  # --- Model Loading ---
 
74
  def load_ner_model():
75
  """Loads the GLiNER model and caches it."""
76
  try:
77
+ return GLiNER.from_pretrained("gliner-community/gliner_large-v2.5", nested_ner=True, num_gen_sequences=2, gen_constraints= labels)
78
  except Exception as e:
79
  st.error(f"Failed to load NER model. Please check your internet connection or model availability: {e}")
80
  st.stop()