Spaces:
Sleeping
Sleeping
File size: 460 Bytes
38b5da8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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() |