abhiii commited on
Commit
683a289
·
verified ·
1 Parent(s): 20004f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -17
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("Dependency visualizer")
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
- input_text = st.text_input("Text", default_value)
32
- doc = nlp(input_text)
33
-
34
- # # Display a section header:
35
- # st.header("Dependency visualizer")`
36
- # # style="dep" indicates dependencies should be generated.
37
- # dep_svg = displacy.render(doc, style=”dep, jupyter=False)
38
- # st.image(dep_svg, width=400, use_column_width=’never’)
39
-
40
- # Add a section header:
41
- st.header("Entity visualizer")
42
- # Take the text from the input field and render the entity html.
43
- # Note that style="ent" indicates entities.
44
- ent_html = displacy.render(doc, style="ent", jupyter=False)
45
- # Display the entity visualization in the browser:
46
- st.markdown(ent_html, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
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)