awacke1 commited on
Commit
545e6f3
·
verified ·
1 Parent(s): 60f22d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -29,16 +29,15 @@ st.sidebar.header("PHI De-identification with Presidio")
29
 
30
  model_help_text = "Select Named Entity Recognition (NER) model for PHI detection."
31
  model_list = [
32
- ("spaCy/en_core_web_lg", "https://huggingface.co/spacy/en_core_web_lg"),
33
- ("HuggingFace/obi/deid_roberta_i2b2", "https://huggingface.co/obi/deid_roberta_i2b2"),
34
  ("flair/ner-english-large", "https://huggingface.co/flair/ner-english-large"),
 
35
  ("HuggingFace/StanfordAIMI/stanford-deidentifier-base", "https://huggingface.co/StanfordAIMI/stanford-deidentifier-base"),
36
  ]
37
 
38
  st_model = st.sidebar.selectbox(
39
  "NER model package",
40
  [model[0] for model in model_list],
41
- index=1,
42
  help=model_help_text,
43
  )
44
 
@@ -48,7 +47,7 @@ st.sidebar.markdown(f"[View model on HuggingFace]({selected_model_url})")
48
 
49
  # Extract model package
50
  st_model_package = st_model.split("/")[0]
51
- st_model = st_model if st_model_package.lower() not in ("spacy", "huggingface") else "/".join(st_model.split("/")[1:])
52
 
53
  analyzer_params = (st_model_package, st_model)
54
  st.sidebar.warning("Note: Models might take some time to download on first run.")
@@ -97,7 +96,7 @@ with col1:
97
  analyzer = analyzer_engine(*analyzer_params)
98
  except Exception as e:
99
  st.error(f"Failed to load model: {str(e)}")
100
- st.info("Ensure models are downloaded (e.g., 'python -m spacy download en_core_web_lg') and check network/permissions.")
101
  raise
102
 
103
  # Analyze
 
29
 
30
  model_help_text = "Select Named Entity Recognition (NER) model for PHI detection."
31
  model_list = [
 
 
32
  ("flair/ner-english-large", "https://huggingface.co/flair/ner-english-large"),
33
+ ("HuggingFace/obi/deid_roberta_i2b2", "https://huggingface.co/obi/deid_roberta_i2b2"),
34
  ("HuggingFace/StanfordAIMI/stanford-deidentifier-base", "https://huggingface.co/StanfordAIMI/stanford-deidentifier-base"),
35
  ]
36
 
37
  st_model = st.sidebar.selectbox(
38
  "NER model package",
39
  [model[0] for model in model_list],
40
+ index=0,
41
  help=model_help_text,
42
  )
43
 
 
47
 
48
  # Extract model package
49
  st_model_package = st_model.split("/")[0]
50
+ st_model = st_model if st_model_package.lower() not in ("huggingface") else "/".join(st_model.split("/")[1:])
51
 
52
  analyzer_params = (st_model_package, st_model)
53
  st.sidebar.warning("Note: Models might take some time to download on first run.")
 
96
  analyzer = analyzer_engine(*analyzer_params)
97
  except Exception as e:
98
  st.error(f"Failed to load model: {str(e)}")
99
+ st.info("Ensure models are downloaded and check network/permissions.")
100
  raise
101
 
102
  # Analyze