Spaces:
Sleeping
Sleeping
Download app.py from Beasto/SpamClassifierNaiveBayes: direct link, hf CLI and curl.
- Browser
- Download file 644 Bytes
-
https://huggingface.co/spaces/Beasto/SpamClassifierNaiveBayes/resolve/main/app.py
- Command line
-
hf download hf://spaces/Beasto/SpamClassifierNaiveBayes/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Beasto/SpamClassifierNaiveBayes/resolve/main/app.py
644 Bytes
| from joblib import load | |
| from sklearn.feature_extraction.text import TfidfVectorizer | |
| import numpy as np | |
| import streamlit as st | |
| st.header('Spam Detection using Naive Bayes Classifier') | |
| vectorizer = load('tfidf_vectorizer.joblib') | |
| user_input = st.text_input("Enter some text:", "") | |
| if user_input is not None and user_input is not "": | |
| x = vectorizer.transform([user_input]) | |
| model = load('Naive_Bayes_Spam_Detection.joblib') | |
| pred = model.predict(x) | |
| if pred[0] == 1: | |
| st.write('The entered text is a Spam') | |
| elif pred[0] == 0: | |
| st.write('The entered text is not a Spam') | |
| else: | |
| st.write('Error, Try again') |