Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from textblob import TextBlob
|
|
4 |
from transformers import BertForSequenceClassification, AdamW, BertConfig
|
5 |
st.set_page_config(layout='wide', initial_sidebar_state='expanded')
|
6 |
col1, col2= st.columns(2)
|
7 |
-
|
8 |
with col1:
|
9 |
st.title("Spamd: Turkish Spam Detector")
|
10 |
st.markdown("Message spam detection tool for Turkish language. Due the small size of the dataset, I decided to go with transformers technology Google BERT. Using the Turkish pre-trained model BERTurk, I imporved the accuracy of the tool by 18 percent compared to the previous model which used fastText.")
|
@@ -55,10 +55,12 @@ if st.button('Load Model', disabled=False):
|
|
55 |
prediction = 'Spam' if np.argmax(output.logits.cpu().numpy()).flatten().item() == 1 else 'Normal'
|
56 |
pred = 'Predicted Class: '+ prediction
|
57 |
return pred
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
st.
|
|
|
|
|
62 |
|
63 |
|
64 |
|
|
|
4 |
from transformers import BertForSequenceClassification, AdamW, BertConfig
|
5 |
st.set_page_config(layout='wide', initial_sidebar_state='expanded')
|
6 |
col1, col2= st.columns(2)
|
7 |
+
flag = False
|
8 |
with col1:
|
9 |
st.title("Spamd: Turkish Spam Detector")
|
10 |
st.markdown("Message spam detection tool for Turkish language. Due the small size of the dataset, I decided to go with transformers technology Google BERT. Using the Turkish pre-trained model BERTurk, I imporved the accuracy of the tool by 18 percent compared to the previous model which used fastText.")
|
|
|
55 |
prediction = 'Spam' if np.argmax(output.logits.cpu().numpy()).flatten().item() == 1 else 'Normal'
|
56 |
pred = 'Predicted Class: '+ prediction
|
57 |
return pred
|
58 |
+
flag = True
|
59 |
+
if flag:
|
60 |
+
with col2:
|
61 |
+
text = st.text_input("Enter the text you'd like to analyze for spam.")
|
62 |
+
if text or st.button('Analyze'):
|
63 |
+
st.header(predict(text))
|
64 |
|
65 |
|
66 |
|