File size: 469 Bytes
38b5da8
 
 
 
 
 
 
 
8a8eac3
38b5da8
 
 
 
 
8a8eac3
 
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 "Phishing Email"

iface = gr.Interface(
    fn=predict,
    inputs="text",
    outputs="label",
    title="Spam or Phishing",
    description="Enter Email body to classify it as spam or phishing.",
)

iface.launch()