Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from spacy import displacy
|
|
| 7 |
nlp = en_pipeline.load()
|
| 8 |
|
| 9 |
# Display a section header:
|
| 10 |
-
st.header("
|
| 11 |
|
| 12 |
# adding the text that will show in the text box as default
|
| 13 |
default_value = '''While traveling through New York, Emily received an email from her bank at emily.brown@example.com informing her about a suspicious activity on her credit card number 4532-8291-1283-9427. She quickly noted down the IP address 192.168.1.1 from which the transaction was attempted. Concerned, she called her bank at (800) 555-1234 and provided her US bank account number 1234567890123456 to verify her identity.
|
|
@@ -28,19 +28,26 @@ During the journey, they planned to visit several locations including Los Angele
|
|
| 28 |
|
| 29 |
For added security, she enabled two-factor authentication on all her accounts and noted down her backup email, emily.backup@example.org, in case she needed to recover any information.'''
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
#
|
| 43 |
-
#
|
| 44 |
-
|
| 45 |
-
#
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
nlp = en_pipeline.load()
|
| 8 |
|
| 9 |
# Display a section header:
|
| 10 |
+
st.header("PII-Redaction")
|
| 11 |
|
| 12 |
# adding the text that will show in the text box as default
|
| 13 |
default_value = '''While traveling through New York, Emily received an email from her bank at emily.brown@example.com informing her about a suspicious activity on her credit card number 4532-8291-1283-9427. She quickly noted down the IP address 192.168.1.1 from which the transaction was attempted. Concerned, she called her bank at (800) 555-1234 and provided her US bank account number 1234567890123456 to verify her identity.
|
|
|
|
| 28 |
|
| 29 |
For added security, she enabled two-factor authentication on all her accounts and noted down her backup email, emily.backup@example.org, in case she needed to recover any information.'''
|
| 30 |
|
| 31 |
+
|
| 32 |
+
form = st.form(key='my-form')
|
| 33 |
+
input_text = form.text_input("Enter your text...", default_value)
|
| 34 |
+
submit = form.form_submit_button('Submit')
|
| 35 |
+
|
| 36 |
+
st.divider()
|
| 37 |
+
|
| 38 |
+
if submit:
|
| 39 |
+
doc = nlp(input_text)
|
| 40 |
+
|
| 41 |
+
# # Display a section header:
|
| 42 |
+
# st.header("Dependency visualizer")`
|
| 43 |
+
# # style="dep" indicates dependencies should be generated.
|
| 44 |
+
# dep_svg = displacy.render(doc, style=”dep, jupyter=False)
|
| 45 |
+
# st.image(dep_svg, width=400, use_column_width=’never’)
|
| 46 |
+
|
| 47 |
+
# Add a section header:
|
| 48 |
+
st.header("Entity visualizer")
|
| 49 |
+
# Take the text from the input field and render the entity html.
|
| 50 |
+
# Note that style="ent" indicates entities.
|
| 51 |
+
ent_html = displacy.render(doc, style="ent", jupyter=False)
|
| 52 |
+
# Display the entity visualization in the browser:
|
| 53 |
+
st.markdown(ent_html, unsafe_allow_html=True)
|