Sharad9084 commited on
Commit
cd302d1
·
verified ·
1 Parent(s): 05037f0

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +32 -0
  2. model.pkl +3 -0
  3. vectorizer.pkl +3 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+
4
+ # Load the model and vectorizer
5
+ with open("model.pkl", "rb") as f:
6
+ model = pickle.load(f)
7
+
8
+ with open("vectorizer.pkl", "rb") as f:
9
+ vectorizer = pickle.load(f)
10
+
11
+ # Streamlit App
12
+ st.title("📩 SMS Spam Classifier")
13
+
14
+ st.write("Enter an SMS message below to check whether it's **Spam** or **Not Spam**.")
15
+
16
+ # Text input box
17
+ sms_input = st.text_area("Enter your message here:")
18
+
19
+ # Predict button
20
+ if st.button("Predict"):
21
+ if sms_input.strip() == "":
22
+ st.warning("⚠️ Please enter a message to classify.")
23
+ else:
24
+ # Transform input and predict
25
+ input_vector = vectorizer.transform([sms_input])
26
+ prediction = model.predict(input_vector)[0]
27
+
28
+ # Output result
29
+ if prediction == 1:
30
+ st.error("🚫 This message is **Spam**.")
31
+ else:
32
+ st.success("✅ This message is **Not Spam**.")
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:555523bd2e2e54b6f5dcadf51052fb4a41d195dc3abe2826c355d75a623869fa
3
+ size 96608
vectorizer.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66e69cf50dbbc7782938b8340ad91bbb01722063f528e331c5bbf5d379fdb062
3
+ size 105805