vonewman commited on
Commit
7c44018
1 Parent(s): 3f67191

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -18
app.py CHANGED
@@ -70,6 +70,7 @@ def tag_sentence(text):
70
  predictions = predict_ner_labels(model, tokenizer, text)
71
  # Créez un DataFrame avec les colonnes "words" et "tags"
72
  df = pd.DataFrame({'words': text.split(), 'tags': predictions})
 
73
  return df
74
 
75
  st.title("📘 Named Entity Recognition Wolof")
@@ -96,21 +97,4 @@ if submit_button:
96
  file_name="results.text", mime='text/plain', key='text')
97
  with c3:
98
  jsonbutton = st.download_button(label="📥 Download .json", data=convert_json(results),
99
- file_name="results.json", mime='application/json', key='json')
100
- st.header("")
101
- c1, c2, c3 = st.columns([1, 3, 1])
102
- with c2:
103
- st.table(results[['words', 'tags']])
104
-
105
- st.header("")
106
- st.header("")
107
- st.header("")
108
- with st.expander("ℹ️ - About this app", expanded=True):
109
- st.write(
110
- """
111
- - The **Named Entity Recognition Wolof** app is a tool that performs named entity recognition in Wolof.
112
- - The available entities are: *corporation*, *location*, *person*, and *date*.
113
- - The app uses the [XLMRoberta model](https://huggingface.co/xlm-roberta-base), fine-tuned on the [masakhaNER](https://huggingface.co/datasets/masakhane/masakhaner2) dataset.
114
- - The model uses the **byte-level BPE tokenizer**. Each sentence is first tokenized.
115
- """
116
- )
 
70
  predictions = predict_ner_labels(model, tokenizer, text)
71
  # Créez un DataFrame avec les colonnes "words" et "tags"
72
  df = pd.DataFrame({'words': text.split(), 'tags': predictions})
73
+ df['tags'] = df['tags'].map(lambda x: f'background-color: lightblue' if x != 'O' else '')
74
  return df
75
 
76
  st.title("📘 Named Entity Recognition Wolof")
 
97
  file_name="results.text", mime='text/plain', key='text')
98
  with c3:
99
  jsonbutton = st.download_button(label="📥 Download .json", data=convert_json(results),
100
+ file_name="results.json", mime='application/json