spam-detector / app.py
sdafd's picture
Update app.py
1458121 verified
raw history blame
No virus
645 Bytes
import gradio as gr
from transformers import pipeline
def analyze_output(input_text):
pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
result = pipe(input_text)[0]
if result["label"] == "LABEL_0":
return {"type": "Not Spam", "probability": result["score"]}
else:
return {"type": "Spam", "probability": result["score"]}
iface = gr.Interface(
fn=analyze_output,
inputs=gr.Textbox(),
outputs=["text", "text"],
live=False,
title="Spam Classification App",
description="Enter a text to classify it as Spam or Not Spam.",
theme="compact"
)
iface.launch()