Spaces:
Build error
Build error
Upload 4 files
Browse files
app.py
CHANGED
@@ -70,13 +70,16 @@ def mask_school_names(text):
|
|
70 |
text = re.sub(pattern, lambda m: to_chosung(m.group(1)) + (" " if not attach else "") + m.group(2), text)
|
71 |
return text
|
72 |
|
|
|
73 |
def mask_department(text):
|
74 |
text = re.sub(r"([가-힣]{2,20}학과)", lambda m: to_chosung(m.group(1)[:-2]) + "학과", text)
|
75 |
return text
|
76 |
|
|
|
77 |
def sanitize_sensitive_info(text, keyword_string, replace_word):
|
78 |
text = mask_school_names(text)
|
79 |
text = mask_department(text)
|
|
|
80 |
text = re.sub(r"(\d)학년\s?(\d)반", r"*학년 *반", text)
|
81 |
|
82 |
keywords = [k.strip() for k in keyword_string.split(",") if k.strip()]
|
@@ -125,14 +128,12 @@ def remask_with_mapping(text, mapping_string):
|
|
125 |
with gr.Blocks() as demo:
|
126 |
gr.Markdown("🛡️ 민감정보 마스킹 [땡땡이 마스킹] : 이름 + 민감정보 + 초/중/고 마스킹기 (초성 기반)")
|
127 |
input_text = gr.Textbox(lines=15, label="📥 원본 텍스트 입력")
|
128 |
-
keyword_input = gr.Textbox(lines=1, label="기관 키워드 (쉼표로 구분)", value="굿네이버스, good neighbors, gn,
|
129 |
replace_input = gr.Textbox(lines=1, label="치환할 텍스트", value="우리기관")
|
130 |
run_button = gr.Button("🚀 마스킹 실행")
|
131 |
masked_output = gr.Textbox(lines=15, label="🔐 마스킹된 텍스트")
|
132 |
-
mapping_output = gr.Textbox(lines=10, label="🏷️ 이름 태그 매핑
|
133 |
-
|
134 |
-
|
135 |
run_button.click(fn=apply_masking, inputs=[input_text, keyword_input, replace_input], outputs=[masked_output, mapping_output])
|
136 |
-
|
137 |
-
|
138 |
demo.launch()
|
|
|
70 |
text = re.sub(pattern, lambda m: to_chosung(m.group(1)) + (" " if not attach else "") + m.group(2), text)
|
71 |
return text
|
72 |
|
73 |
+
|
74 |
def mask_department(text):
|
75 |
text = re.sub(r"([가-힣]{2,20}학과)", lambda m: to_chosung(m.group(1)[:-2]) + "학과", text)
|
76 |
return text
|
77 |
|
78 |
+
|
79 |
def sanitize_sensitive_info(text, keyword_string, replace_word):
|
80 |
text = mask_school_names(text)
|
81 |
text = mask_department(text)
|
82 |
+
text = re.sub(r"(\d)학년(\s?(\d)반)?", lambda m: "*학년" + (" *반" if m.group(3) else ""), text)
|
83 |
text = re.sub(r"(\d)학년\s?(\d)반", r"*학년 *반", text)
|
84 |
|
85 |
keywords = [k.strip() for k in keyword_string.split(",") if k.strip()]
|
|
|
128 |
with gr.Blocks() as demo:
|
129 |
gr.Markdown("🛡️ 민감정보 마스킹 [땡땡이 마스킹] : 이름 + 민감정보 + 초/중/고 마스킹기 (초성 기반)")
|
130 |
input_text = gr.Textbox(lines=15, label="📥 원본 텍스트 입력")
|
131 |
+
keyword_input = gr.Textbox(lines=1, label="기관 키워드 (쉼표로 구분)", value="굿네이버스, good neighbors, gn, 사회복지법인 굿네이버스")
|
132 |
replace_input = gr.Textbox(lines=1, label="치환할 텍스트", value="우리기관")
|
133 |
run_button = gr.Button("🚀 마스킹 실행")
|
134 |
masked_output = gr.Textbox(lines=15, label="🔐 마스킹된 텍스트")
|
135 |
+
mapping_output = gr.Textbox(lines=10, label="🏷️ 이름 태그 매핑", interactive=False)
|
136 |
+
|
|
|
137 |
run_button.click(fn=apply_masking, inputs=[input_text, keyword_input, replace_input], outputs=[masked_output, mapping_output])
|
138 |
+
|
|
|
139 |
demo.launch()
|