Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
classifier = pipeline("text-classification", model="Al-Chan/Malicious_Prompt_Classifier")
|
6 |
+
|
7 |
+
def text(text):
|
8 |
+
return classifier(text)[0]['label']
|
9 |
+
|
10 |
+
demo = gr.Interface(
|
11 |
+
fn=text,
|
12 |
+
inputs=["text"],
|
13 |
+
outputs=["text"],
|
14 |
+
)
|