Commit
·
1b7d446
1
Parent(s):
cdc1333
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
import streamlit as st
|
| 4 |
+
import pickle
|
| 5 |
+
|
| 6 |
+
# loading the trained model
|
| 7 |
+
model = pickle.load(open('model.pkl', 'rb'))
|
| 8 |
+
|
| 9 |
+
# create title
|
| 10 |
+
st.title('Predicting if message is spam or not')
|
| 11 |
+
|
| 12 |
+
message = st.text_input('Enter a message')
|
| 13 |
+
|
| 14 |
+
submit = st.button('Predict')
|
| 15 |
+
|
| 16 |
+
if submit:
|
| 17 |
+
prediction = model.predict([message])
|
| 18 |
+
|
| 19 |
+
# print(prediction)
|
| 20 |
+
# st.write(prediction)
|
| 21 |
+
|
| 22 |
+
if prediction[0] == 'spam':
|
| 23 |
+
st.warning('This message is spam')
|
| 24 |
+
else:
|
| 25 |
+
st.success('This message is Legit (HAM)')
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
st.balloons()
|