mzameshina commited on
Commit
0a5d4c9
1 Parent(s): a8d57ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -130,7 +130,16 @@ def encrypt_doc_fn(doc):
130
  anonymized_doc_output: gr.update(visible=True, value=None),
131
  }
132
 
133
-
 
 
 
 
 
 
 
 
 
134
  def encrypt_query_fn(query):
135
 
136
  print(f"\n------------ Step 2: Query encryption: {query=}")
@@ -644,7 +653,7 @@ with demo:
644
  outputs=[anonymized_doc_output, anonymized_query_output, identified_words_output_df],
645
  )
646
 
647
- ########################## ChatGpt Part ##########################
648
 
649
  # Launch the app
650
  demo.launch(share=False)
 
130
  anonymized_doc_output: gr.update(visible=True, value=None),
131
  }
132
 
133
+ import presidio-analyzer
134
+ import presidio-anonymizer
135
+
136
+ def anonymization_with_presidio(prompt):
137
+ analyzer = AnalyzerEngine()
138
+ anonymizer = AnonymizerEngine()
139
+ results = analyzer.analyze(text=prompt,language='en')
140
+ result = anonymizer.anonymize(text=prompt, analyzer_results=results)
141
+ return result.text
142
+
143
  def encrypt_query_fn(query):
144
 
145
  print(f"\n------------ Step 2: Query encryption: {query=}")
 
653
  outputs=[anonymized_doc_output, anonymized_query_output, identified_words_output_df],
654
  )
655
 
656
+ ########################## Presidio ##########################
657
 
658
  # Launch the app
659
  demo.launch(share=False)