arogeriogel commited on
Commit
7cc98e5
1 Parent(s): 5baa2aa

update app

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -15,7 +15,7 @@ from detoxify import Detoxify
15
 
16
  st.title("Anonymise your text!")
17
  st.markdown(
18
- "This mini-app anonymises text using Flair and Presidio. You can find the code in the Files and versions tab above."
19
  )
20
 
21
  # Configure logger
@@ -276,13 +276,14 @@ st_entities = st.sidebar.multiselect(
276
 
277
  col1, col2 = st.columns(2)
278
 
 
279
  with col1:
280
  analyze_now = st.button(
281
  label="Analyse text",
282
  type="primary",
283
  on_click=analyze_text,
284
  )
285
-
286
  with col2:
287
  anonymise_now = st.button(
288
  label="Anonymise text",
@@ -303,10 +304,11 @@ with col1:
303
  annotated_tokens=annotate()
304
  annotated_text(*annotated_tokens)
305
  st.write(st.session_state.analyze_results)
306
- else:
307
  st.write("No PII was found.")
 
308
  with col2:
309
  if st.session_state.anon_results:
310
  st.write(st.session_state.anon_results.text)
311
- else:
312
  st.write("No PII was found.")
 
15
 
16
  st.title("Anonymise your text!")
17
  st.markdown(
18
+ "This mini-app anonymises text using Flair and Presidio. You can find the code in the Files and versions tab above. The development of this app was inspired by previous work, namely this [pii-anonimyzer](https://huggingface.co/spaces/beki/pii-anonymizer)"
19
  )
20
 
21
  # Configure logger
 
276
 
277
  col1, col2 = st.columns(2)
278
 
279
+ analyze_now=False
280
  with col1:
281
  analyze_now = st.button(
282
  label="Analyse text",
283
  type="primary",
284
  on_click=analyze_text,
285
  )
286
+ anonymise_now=False
287
  with col2:
288
  anonymise_now = st.button(
289
  label="Anonymise text",
 
304
  annotated_tokens=annotate()
305
  annotated_text(*annotated_tokens)
306
  st.write(st.session_state.analyze_results)
307
+ if not st.session_state.analyze_results and analyze_now:
308
  st.write("No PII was found.")
309
+
310
  with col2:
311
  if st.session_state.anon_results:
312
  st.write(st.session_state.anon_results.text)
313
+ if not st.session_state.analyze_results and anonymise_now:
314
  st.write("No PII was found.")