Sharathhebbar24 commited on
Commit
4db0113
β€’
1 Parent(s): da02aa2

Upload 4 files

Browse files
Files changed (4) hide show
  1. app.py +35 -0
  2. requirements.txt +53 -0
  3. spam.pickle +3 -0
  4. vectorizer.pickle +3 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+
4
+
5
+ class SMSSpamDetection:
6
+ def __init__(self):
7
+ st.header('πŸ¦œπŸ”— SMS Spam Detection')
8
+
9
+
10
+ def model_response(self, text):
11
+ with open('vectorizer.pickle', 'rb') as f:
12
+ cv = pickle.load(f)
13
+ res = cv.transform([text]).toarray()
14
+ with open('spam.pickle', 'rb') as f:
15
+ clf = pickle.load(f)
16
+ op = clf.predict(res)
17
+ if op[0] == 'ham':
18
+ label = 'not spam'
19
+ else:
20
+ label = 'spam'
21
+ return label
22
+
23
+ def get_input(self):
24
+ input_text = st.text_input("Post your message here: ", key='input')
25
+ return input_text
26
+
27
+ sms = SMSSpamDetection()
28
+ user_input = sms.get_input()
29
+ response = sms.model_response(user_input)
30
+
31
+ submit = st.button("Submit")
32
+
33
+ if submit:
34
+ st.subheader("Output")
35
+ st.write(f"The given message was: {response}")
requirements.txt ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==5.1.2
2
+ attrs==23.1.0
3
+ blinker==1.6.3
4
+ cachetools==5.3.2
5
+ certifi==2023.7.22
6
+ charset-normalizer==3.3.1
7
+ click==8.1.7
8
+ colorama==0.4.6
9
+ Flask==3.0.0
10
+ gitdb==4.0.11
11
+ GitPython==3.1.40
12
+ idna==3.4
13
+ importlib-metadata==6.8.0
14
+ itsdangerous==2.1.2
15
+ Jinja2==3.1.2
16
+ joblib==1.3.2
17
+ jsonschema==4.19.1
18
+ jsonschema-specifications==2023.7.1
19
+ markdown-it-py==3.0.0
20
+ MarkupSafe==2.1.3
21
+ mdurl==0.1.2
22
+ numpy==1.26.1
23
+ packaging==23.2
24
+ pandas==2.1.1
25
+ Pillow==10.1.0
26
+ protobuf==4.24.4
27
+ pyarrow==13.0.0
28
+ pydeck==0.8.1b0
29
+ Pygments==2.16.1
30
+ python-dateutil==2.8.2
31
+ pytz==2023.3.post1
32
+ referencing==0.30.2
33
+ requests==2.31.0
34
+ rich==13.6.0
35
+ rpds-py==0.10.6
36
+ scikit-learn==1.3.1
37
+ scipy==1.11.3
38
+ six==1.16.0
39
+ smmap==5.0.1
40
+ streamlit==1.27.2
41
+ tenacity==8.2.3
42
+ threadpoolctl==3.2.0
43
+ toml==0.10.2
44
+ toolz==0.12.0
45
+ tornado==6.3.3
46
+ typing_extensions==4.8.0
47
+ tzdata==2023.3
48
+ tzlocal==5.2
49
+ urllib3==2.0.7
50
+ validators==0.22.0
51
+ watchdog==3.0.0
52
+ Werkzeug==3.0.0
53
+ zipp==3.17.0
spam.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c7506f1435b2e4b44951cc16d01da7730ae68d4e525e7d69326a74ae02c8503
3
+ size 239512
vectorizer.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea278e6ce2c5dd8d604ccc0c2ff33494feeedce956cfa0d4009f777bfa7885ec
3
+ size 90546