benjika's picture
Create app.py
38b5da8 verified
raw
history blame
460 Bytes
import gradio as gr
from transformers import pipeline
model_path = "./model"
classifier = pipeline("text-classification", model="./model")
def predict(text):
result = classifier(text)
return "Safe Email" if result[0]['label'] == "LABEL_0" else "Spam Email"
iface = gr.Interface(
fn=predict,
inputs="text",
outputs="label",
title="Spam or not",
description="Enter Email body to classify it as spam or not spam.",
)
iface.launch()