Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| # In[2]: | |
| import gradio as gr | |
| from joblib import load | |
| model = load("model.joblib") | |
| cv = load("cv.joblib") | |
| def prediction(Message): | |
| msg = [Message] | |
| msg_transform = cv.transform(msg) | |
| pred = model.predict(msg_transform)[0] | |
| return "An spam email☹️" if pred==1 else "Not an spam email☺️" | |
| iface = gr.Interface(fn = prediction, | |
| inputs = gr.Textbox(), | |
| outputs = 'text', | |
| title = "Email Detector", | |
| description = "This app can identify whether an email is spam or not" | |
| ) | |
| iface.launch() | |
| # In[ ]: | |