Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,9 +9,12 @@ import streamlit.components.v1 as components
|
|
| 9 |
from annotated_text import annotated_text
|
| 10 |
from streamlit_tags import st_tags
|
| 11 |
from PyPDF2 import PdfReader, PdfWriter
|
| 12 |
-
from
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
st.set_page_config(
|
| 17 |
page_title="Presidio PHI De-identification",
|
|
@@ -93,7 +96,7 @@ with col1:
|
|
| 93 |
# Analyze
|
| 94 |
analyzer = analyzer_engine(*analyzer_params)
|
| 95 |
st_analyze_results = analyze(
|
| 96 |
-
analyzer,
|
| 97 |
text=text,
|
| 98 |
entities=get_supported_entities(*analyzer_params),
|
| 99 |
language="en",
|
|
@@ -111,12 +114,10 @@ with col1:
|
|
| 111 |
st.info("No PHI detected")
|
| 112 |
|
| 113 |
# Anonymize
|
| 114 |
-
anonymizer = AnonymizerEngine()
|
| 115 |
anonymized_result = anonymize(
|
| 116 |
text=text,
|
| 117 |
operator=st_operator,
|
| 118 |
analyze_results=st_analyze_results,
|
| 119 |
-
anonymizer=anonymizer,
|
| 120 |
)
|
| 121 |
|
| 122 |
# Create new PDF
|
|
|
|
| 9 |
from annotated_text import annotated_text
|
| 10 |
from streamlit_tags import st_tags
|
| 11 |
from PyPDF2 import PdfReader, PdfWriter
|
| 12 |
+
from presidio_helpers import (
|
| 13 |
+
analyzer_engine,
|
| 14 |
+
get_supported_entities,
|
| 15 |
+
analyze,
|
| 16 |
+
anonymize,
|
| 17 |
+
)
|
| 18 |
|
| 19 |
st.set_page_config(
|
| 20 |
page_title="Presidio PHI De-identification",
|
|
|
|
| 96 |
# Analyze
|
| 97 |
analyzer = analyzer_engine(*analyzer_params)
|
| 98 |
st_analyze_results = analyze(
|
| 99 |
+
analyzer=analyzer,
|
| 100 |
text=text,
|
| 101 |
entities=get_supported_entities(*analyzer_params),
|
| 102 |
language="en",
|
|
|
|
| 114 |
st.info("No PHI detected")
|
| 115 |
|
| 116 |
# Anonymize
|
|
|
|
| 117 |
anonymized_result = anonymize(
|
| 118 |
text=text,
|
| 119 |
operator=st_operator,
|
| 120 |
analyze_results=st_analyze_results,
|
|
|
|
| 121 |
)
|
| 122 |
|
| 123 |
# Create new PDF
|