Ai4Privacy-v1 / app.py
Isotonic's picture
Update app.py
60fc3f2 verified
raw
history blame contribute delete
532 Bytes
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers.pipelines import pipeline
import gradio as gr
import os
masker = pipeline(
task="token-classification",
model="Isotonic/distilbert_finetuned_ai4privacy",
device="cpu",
)
def ai4p_gradio(input):
entities = masker(input)
return {"text": input, "entities": entities}
demo = gr.Interface(
fn=ai4p_gradio,
inputs=gr.Textbox(lines=10, label="Input"),
outputs=gr.HighlightedText(label="output"),
)
demo.launch()