Spaces:
Sleeping
Sleeping
KarishmaShirsath
commited on
Commit
•
a73656c
1
Parent(s):
46dbc0f
Add drop down model
Browse files
app.py
CHANGED
@@ -25,8 +25,8 @@ def cached_anonimize_text(text, operator):
|
|
25 |
return FlairRecognizer2.anonymize(text, operator)
|
26 |
|
27 |
@st.cache_resource
|
28 |
-
def anonymize(text, operator):
|
29 |
-
return PiiMaskingService().anonymize(text, operator)
|
30 |
|
31 |
def download_masked_file(masked_text, file_extension):
|
32 |
|
@@ -91,16 +91,14 @@ def main():
|
|
91 |
""",
|
92 |
)
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
# index=2,
|
103 |
-
# )
|
104 |
|
105 |
masked_text_public = ''
|
106 |
if upload_option == 'Text Input':
|
@@ -108,7 +106,7 @@ def main():
|
|
108 |
if st.button('Analyze'):
|
109 |
with st.spinner('Wait for it... the model is loading'):
|
110 |
# cached_predict_ner_tags(input_text)
|
111 |
-
masked_text = anonymize(input_text, st_operator)
|
112 |
# masked_text = cached_anonimize_text(input_text, st_operator)
|
113 |
st.text_area("Masked text:", value=masked_text, height=200)
|
114 |
elif upload_option == 'File Upload':
|
|
|
25 |
return FlairRecognizer2.anonymize(text, operator)
|
26 |
|
27 |
@st.cache_resource
|
28 |
+
def anonymize(text, operator, model):
|
29 |
+
return PiiMaskingService().anonymize(text, operator, model)
|
30 |
|
31 |
def download_masked_file(masked_text, file_extension):
|
32 |
|
|
|
91 |
""",
|
92 |
)
|
93 |
|
94 |
+
st_model = st.sidebar.selectbox(
|
95 |
+
"NER model package",
|
96 |
+
[
|
97 |
+
"flair/ner-english-large",
|
98 |
+
"HuggingFace/obi/deid_roberta_i2b2",
|
99 |
+
],
|
100 |
+
index=1,
|
101 |
+
)
|
|
|
|
|
102 |
|
103 |
masked_text_public = ''
|
104 |
if upload_option == 'Text Input':
|
|
|
106 |
if st.button('Analyze'):
|
107 |
with st.spinner('Wait for it... the model is loading'):
|
108 |
# cached_predict_ner_tags(input_text)
|
109 |
+
masked_text = anonymize(input_text, st_operator, st_model)
|
110 |
# masked_text = cached_anonimize_text(input_text, st_operator)
|
111 |
st.text_area("Masked text:", value=masked_text, height=200)
|
112 |
elif upload_option == 'File Upload':
|