Spaces:
Sleeping
Sleeping
v0
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import transformers
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
model_name = "lsb/wikipedia-protected-classes"
|
6 |
+
model_name = "lsb/test_trainer" # lol no time to get it right
|
7 |
+
|
8 |
+
pipe = pipeline("text-classification", model_name)
|
9 |
+
|
10 |
+
def predict(text):
|
11 |
+
return "🛡️ Protected" if pipe(text)[0]['label'] == "LABEL_1" else "✅ General Interest"
|
12 |
+
|
13 |
+
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
14 |
+
iface.launch()
|
15 |
+
|