Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
get_completion = pipeline("ner", model="tororoin/longformer-8bitadam-2048-main")
|
5 |
+
|
6 |
+
def ner(input):
|
7 |
+
output = get_completion(input)
|
8 |
+
return {"text": input, "entities": output}
|
9 |
+
|
10 |
+
demo = gr.Interface(fn=ner,
|
11 |
+
inputs=[gr.Textbox(label="Text to find entities", lines=4)],
|
12 |
+
outputs=[gr.HighlightedText(label="Text with entities")],
|
13 |
+
title="Detecting PII",
|
14 |
+
description="Find PII in text data! A small demo",
|
15 |
+
allow_flagging="never",
|
16 |
+
examples=["My name is Andrew and I live in at Baker Str"])
|
17 |
+
demo.launch()
|