Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
|
5 |
+
def analyze_output(input):
|
6 |
+
pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
|
7 |
+
x = pipe(input)[0]
|
8 |
+
if x["label"] == "LABEL_0":
|
9 |
+
return {"type":"Not Spam", "probability":x["score"]}
|
10 |
+
else:
|
11 |
+
return {"type":"Spam", "probability":x["score"]}
|
12 |
+
|
13 |
+
|
14 |
+
demo = gr.Interface(fn=analyze_output, inputs="text", outputs="text")
|
15 |
+
demo.launch()
|