Skip to content

Commit

Permalink
refacto: update demo to use edsnlp.blank
Browse files Browse the repository at this point in the history
  • Loading branch information
percevalw committed Dec 4, 2023
1 parent 5ca1fdb commit 702ce09
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"""

CODE = """
import spacy
import edsnlp
# Declare the pipeline
nlp = spacy.blank("eds")
nlp = edsnlp.blank("eds")
# General-purpose components
nlp.add_pipe("eds.normalizer")
Expand All @@ -65,6 +65,8 @@
"""

PIPES = {
"Drugs": "drugs",
"CIM10": "cim10",
"Dates": "dates",
"Measurements": "measurements",
"Charlson": "charlson",
Expand All @@ -75,8 +77,6 @@
"CCMU": "emergency_ccmu",
"GEMSA": "emergency_gemsa",
"Covid": "covid",
"CIM10": "cim10",
"Drugs": "drugs",
"Adicap": "adicap",
"Diabetes": "diabetes",
"Tobacco": "tobacco",
Expand All @@ -99,7 +99,7 @@
}


@st.cache(allow_output_mutation=True)
@st.cache_resource()
def load_model(custom_regex: str, **enabled):
pipes = []

Expand Down Expand Up @@ -196,7 +196,7 @@ def load_model(custom_regex: str, **enabled):
"Fuzzy drugs search", value=True, disabled=not st_pipes["drugs"]
)
for title, name in PIPES.items():
if name == "drugs":
if name == "drugs" or name == "cim10":
continue
st_pipes[name] = st.sidebar.checkbox(title, value=True)
st.sidebar.markdown(
Expand Down Expand Up @@ -291,7 +291,7 @@ def load_model(custom_regex: str, **enabled):
end=ent.end_char,
text=ent.text,
label=ent.label_,
normalized_value=ent._.value or "",
normalized_value=str(ent._.value or ""),
negation="YES" if ent._.negation else "NO",
family="YES" if ent._.family else "NO",
hypothesis="YES" if ent._.hypothesis else "NO",
Expand Down

0 comments on commit 702ce09

Please sign in to comment.