Spaces:
Runtime error
Runtime error
Sameer
commited on
Commit
·
05ea149
1
Parent(s):
58c7354
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from keras.layers import Dense,Embedding
|
|
5 |
from keras.utils import pad_sequences
|
6 |
from keras.preprocessing.text import Tokenizer
|
7 |
st.title("Spam-NonSpam Detector")
|
8 |
-
Input=st.
|
9 |
if st.button("Check"):
|
10 |
st.text("Process may take upto a minute. Please be patient. Thank you!")
|
11 |
df=pd.read_csv("mail_data.csv")
|
@@ -31,12 +31,15 @@ if st.button("Check"):
|
|
31 |
Y=Y.reshape(-1,1)
|
32 |
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['acc'])
|
33 |
model.fit(X,Y,epochs=21)
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
st.text("Input:")
|
37 |
st.markdown(Input)
|
38 |
st.text("Output:")
|
39 |
-
if
|
40 |
-
|
41 |
else:
|
42 |
-
|
|
|
|
5 |
from keras.utils import pad_sequences
|
6 |
from keras.preprocessing.text import Tokenizer
|
7 |
st.title("Spam-NonSpam Detector")
|
8 |
+
Input=st.text_area("Input the message below")
|
9 |
if st.button("Check"):
|
10 |
st.text("Process may take upto a minute. Please be patient. Thank you!")
|
11 |
df=pd.read_csv("mail_data.csv")
|
|
|
31 |
Y=Y.reshape(-1,1)
|
32 |
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['acc'])
|
33 |
model.fit(X,Y,epochs=21)
|
34 |
+
seq=tokenizer.texts_to_sequences(input_mail)
|
35 |
+
inp=pad_sequences(seq,padding='post',maxlen=61)
|
36 |
+
a=model.predict(inp)
|
37 |
+
value=a.argmax()
|
38 |
st.text("Input:")
|
39 |
st.markdown(Input)
|
40 |
st.text("Output:")
|
41 |
+
if (value==1):
|
42 |
+
st.text('Non-spam message')
|
43 |
else:
|
44 |
+
st.text('Spam message')
|
45 |
+
|