Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
def analyze_output(input_text):
|
5 |
+
pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
|
6 |
+
result = pipe(input_text)[0]
|
7 |
+
if result["label"] == "LABEL_0":
|
8 |
+
return {"type": "Not Spam", "probability": result["score"]}
|
9 |
+
else:
|
10 |
+
return {"type": "Spam", "probability": result["score"]}
|
11 |
+
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=analyze_output,
|
14 |
+
inputs=gr.Textbox(),
|
15 |
+
outputs=["text", "text"],
|
16 |
+
live=True,
|
17 |
+
interpretation="default",
|
18 |
+
title="Spam Classification App",
|
19 |
+
description="Enter a text to classify it as Spam or Not Spam.",
|
20 |
+
theme="compact"
|
21 |
+
)
|
22 |
+
|
23 |
+
iface.launch()
|