Spaces:
Sleeping
Sleeping
Commit
·
54bc438
1
Parent(s):
fdd8710
Add anonymization app 3
Browse files
app.py
CHANGED
@@ -7,26 +7,8 @@ generator = pipeline("text2text-generation", model="facebook/bart-large", tokeni
|
|
7 |
# Function to construct the anonymization prompt
|
8 |
def construct_prompt(input_text):
|
9 |
prompt = f"""
|
10 |
-
|
11 |
-
|
12 |
-
Please ensure that:
|
13 |
-
1. Personal names (e.g., "John Doe") are replaced with realistic pseudonyms (e.g., "Michael Brown").
|
14 |
-
2. Company names (e.g., "SIA Partners") are replaced with generic placeholders (e.g., "CompanyPlaceholder1").
|
15 |
-
3. Addresses (e.g., "14 rue Championnet") are replaced with "AddressPlaceholder".
|
16 |
-
4. All other identifying information like registration numbers and codes are replaced with generic placeholders (e.g., "NumberPlaceholder").
|
17 |
-
5. Any other part of the text should remain unchanged.
|
18 |
-
|
19 |
-
The output should strictly follow this JSON format:
|
20 |
-
{{
|
21 |
-
"anonymized_text": "The text with all identifying information replaced.",
|
22 |
-
"replacements": {{
|
23 |
-
"Original1": "Replacement1",
|
24 |
-
"Original2": "Replacement2"
|
25 |
-
}}
|
26 |
-
}}
|
27 |
-
|
28 |
-
Here is the input text:
|
29 |
-
|
30 |
"{input_text}"
|
31 |
"""
|
32 |
return prompt.strip()
|
|
|
7 |
# Function to construct the anonymization prompt
|
8 |
def construct_prompt(input_text):
|
9 |
prompt = f"""
|
10 |
+
Please rewrite the input text by writting the text in double.
|
11 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
"{input_text}"
|
13 |
"""
|
14 |
return prompt.strip()
|