blueradiance commited on
Commit
7073649
·
verified ·
1 Parent(s): fbf90c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -275,4 +275,32 @@ def apply_masking(text, keyword_str, replace_word):
275
  final_text = final_name_remask_exact_only(sanitized_text, name_mapping)
276
  mapping_table = "\n".join(f"{k} → {v}" for k, v in name_mapping.items())
277
  return final_text, mapping_table
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  demo.launch()
 
275
  final_text = final_name_remask_exact_only(sanitized_text, name_mapping)
276
  mapping_table = "\n".join(f"{k} → {v}" for k, v in name_mapping.items())
277
  return final_text, mapping_table
278
+
279
+ # 📦 PART 4: 기관 키워드 치환기 + Gradio UI 실행기
280
+ import gradio as gr
281
+
282
+ # ✅ 마스킹 실행 함수는 기존에 작성된 apply_full_masking() 사용
283
+
284
+ with gr.Blocks() as demo:
285
+ gr.Markdown("🧠 **v5.0 마스킹 통합 시스템** — 키워드, 이름, 개인정보, 학교 마스킹")
286
+
287
+ input_text = gr.Textbox(lines=15, label="📄 원문 텍스트")
288
+ keyword_input = gr.Textbox(lines=1, label="기관 키워드 (쉼표로 구분)", value="굿네이버스, 사회복지법인 굿네이버스")
289
+ replace_input = gr.Textbox(lines=1, label="치환할 텍스트", value="우리기관")
290
+ run_button = gr.Button("🚀 실행")
291
+
292
+ masked_output = gr.Textbox(lines=15, label="🔐 마스킹 결과")
293
+ mapping_output = gr.Textbox(lines=10, label="🏷️ 태그 매핑", interactive=False)
294
+
295
+ run_button.click(
296
+ fn=apply_full_masking,
297
+ inputs=[input_text, keyword_input, replace_input],
298
+ outputs=[masked_output, mapping_output]
299
+ )
300
+
301
+ # ✅ 반드시 필요! Gradio 실행
302
+ demo.launch()
303
+
304
+
305
+
306
  demo.launch()