Spaces:
Sleeping
Sleeping
Commit ·
631dead
1
Parent(s): 033a601
Add anonymization app 3
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
# Load a lightweight model
|
| 5 |
-
generator = pipeline("text2text-generation", model="
|
| 6 |
|
| 7 |
# Function to construct the anonymization prompt
|
| 8 |
def construct_prompt(input_text):
|
|
@@ -19,7 +19,7 @@ def construct_prompt(input_text):
|
|
| 19 |
}}
|
| 20 |
|
| 21 |
### Guidelines:
|
| 22 |
-
1. Only replace entity names.
|
| 23 |
2. Ensure the pseudonyms are realistic and appropriate for the type of name being replaced.
|
| 24 |
3. Keep all other parts of the text unchanged.
|
| 25 |
4. If no names are found, return the original text with an empty dictionary.
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
# Load a lightweight model
|
| 5 |
+
generator = pipeline("text2text-generation", model="facebook/bart-large", tokenizer="facebook/bart-large")
|
| 6 |
|
| 7 |
# Function to construct the anonymization prompt
|
| 8 |
def construct_prompt(input_text):
|
|
|
|
| 19 |
}}
|
| 20 |
|
| 21 |
### Guidelines:
|
| 22 |
+
1. Only replace entity or personnal names.
|
| 23 |
2. Ensure the pseudonyms are realistic and appropriate for the type of name being replaced.
|
| 24 |
3. Keep all other parts of the text unchanged.
|
| 25 |
4. If no names are found, return the original text with an empty dictionary.
|