Spaces:
Sleeping
Sleeping
File size: 584 Bytes
0d3453c 79446df 0d3453c 79446df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import gradio as gr
from transformers import pipeline
# โหลด pipeline
pii_detector = pipeline("token-classification", model="iiiorg/piiranha-v1-detect-personal-information", aggregation_strategy="simple")
def detect_pii(text):
results = pii_detector(text)
return results
def create_personal_info_tab():
with gr.Column():
gr.Markdown("### Detect Personal Information (PII)")
textbox = gr.Textbox(label="Enter text", lines=5)
output = gr.JSON(label="Detected Entities")
textbox.change(fn=detect_pii, inputs=textbox, outputs=output) |