Skip to content

Commit d56d0c1

Browse files
LucasDedieupercevalw
authored andcommitted
docs: update demo to compute entities confidence score
1 parent 26d3421 commit d56d0c1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

demo/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def load_model(use_rule_based=False):
2626
nlp.add_pipe("eds_pseudo.context")
2727
else:
2828
nlp = edsnlp.load("AP-HP/eds-pseudo-public")
29+
nlp.pipes.ner.compute_confidence_score = True
2930
model_load_state.empty()
3031
return nlp
3132

@@ -68,7 +69,8 @@ def apply_model(text, use_rule_based):
6869
label=ent.label_,
6970
normalized_value=str(ent._.value or ""),
7071
)
71-
72+
if not use_rule_based:
73+
d["ner_confidence_score"] = ent._.ner_confidence_score
7274
data.append(d)
7375
return data, html
7476

@@ -127,7 +129,7 @@ def apply_model(text, use_rule_based):
127129
if data:
128130
df = pd.DataFrame.from_records(data)
129131
df.normalized_value = df.normalized_value.replace({"None": ""})
130-
st.dataframe(df)
132+
st.dataframe(df, use_container_width=True)
131133

132134
else:
133135
st.markdown("The model did not match any entity...")

0 commit comments

Comments
 (0)