Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,10 @@ def scrub_file(filepath):
|
|
13 |
# Open the original file and strip each line
|
14 |
with open(filepath, 'r', encoding='utf-8') as file:
|
15 |
for line in file:
|
16 |
-
stripped_lines.append(line.strip())
|
|
|
17 |
|
18 |
-
# Overwrite the original file with
|
19 |
with open(filepath, 'w', encoding='utf-8') as file:
|
20 |
for line in stripped_lines:
|
21 |
file.write(line + '\n') # Add '\n' to keep the file structure
|
@@ -31,8 +32,8 @@ def download_file():
|
|
31 |
return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
|
32 |
|
33 |
with gr.Blocks() as demo:
|
34 |
-
gr.Markdown("First upload a file and and then you'll be able download it (but only once!)")
|
35 |
-
gr.Markdown("PII Anonymized:"+pii_anonymizer.anonymize_text_including_proper_nouns_and_addresses("Hello Kripa"))
|
36 |
with gr.Row():
|
37 |
u = gr.UploadButton("Upload a file", file_count="single", file_types=["text"])
|
38 |
d = gr.DownloadButton("Download the file", visible=False)
|
|
|
13 |
# Open the original file and strip each line
|
14 |
with open(filepath, 'r', encoding='utf-8') as file:
|
15 |
for line in file:
|
16 |
+
#stripped_lines.append(line.strip())
|
17 |
+
stripped_lines.append(pii_anonymizer.anonymize_text_including_proper_nouns_and_addresses(line))
|
18 |
|
19 |
+
# Overwrite the original file with pii replaced lines
|
20 |
with open(filepath, 'w', encoding='utf-8') as file:
|
21 |
for line in stripped_lines:
|
22 |
file.write(line + '\n') # Add '\n' to keep the file structure
|
|
|
32 |
return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
|
33 |
|
34 |
with gr.Blocks() as demo:
|
35 |
+
gr.Markdown("First upload a file and and then you'll be able download a PII stripped version of it (but only once!)")
|
36 |
+
#gr.Markdown("PII Anonymized:"+pii_anonymizer.anonymize_text_including_proper_nouns_and_addresses("Hello Kripa"))
|
37 |
with gr.Row():
|
38 |
u = gr.UploadButton("Upload a file", file_count="single", file_types=["text"])
|
39 |
d = gr.DownloadButton("Download the file", visible=False)
|