Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,6 @@ 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 |
-
df['tags'] = df['tags'].map(lambda x: 'background-color: lightblue' if x != 'O' else '')
|
74 |
return df
|
75 |
|
76 |
st.title("📘 Named Entity Recognition Wolof")
|
@@ -98,23 +97,20 @@ if submit_button:
|
|
98 |
with c3:
|
99 |
jsonbutton = st.download_button(label="📥 Download .json", data=convert_json(results),
|
100 |
file_name="results.json", mime='application/json', key='json')
|
101 |
-
|
102 |
st.header("")
|
103 |
-
|
104 |
c1, c2, c3 = st.columns([1, 3, 1])
|
105 |
-
|
106 |
with c2:
|
107 |
-
st.table(results
|
108 |
|
109 |
st.header("")
|
110 |
st.header("")
|
111 |
st.header("")
|
112 |
with st.expander("ℹ️ - About this app", expanded=True):
|
113 |
st.write(
|
114 |
-
"""
|
115 |
- The **Named Entity Recognition Wolof** app is a tool that performs named entity recognition in Wolof.
|
116 |
- The available entities are: *corporation*, *location*, *person*, and *date*.
|
117 |
- The app uses the [XLMRoberta model](https://huggingface.co/xlm-roberta-base), fine-tuned on the [masakhaNER](https://huggingface.co/datasets/masakhane/masakhaner2) dataset.
|
118 |
- The model uses the **byte-level BPE tokenizer**. Each sentence is first tokenized.
|
119 |
"""
|
120 |
-
)
|
|
|
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")
|
|
|
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 |
+
)
|