Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,14 @@ 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.")
|
11 |
with col2:
|
12 |
-
text =
|
13 |
-
aButton =
|
14 |
if st.button('Load Model', disabled=False):
|
15 |
with st.spinner('Wait for it...'):
|
16 |
import torch
|
@@ -57,8 +58,8 @@ if st.button('Load Model', disabled=False):
|
|
57 |
prediction = 'Spam' if np.argmax(output.logits.cpu().numpy()).flatten().item() == 1 else 'Normal'
|
58 |
pred = 'Predicted Class: '+ prediction
|
59 |
return pred
|
60 |
-
|
61 |
-
|
62 |
if not flag:
|
63 |
with col2:
|
64 |
if text or aButton:
|
|
|
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 |
+
placeholder = st.empty()
|
8 |
+
placeholder2 = st.empty()
|
9 |
with col1:
|
10 |
st.title("Spamd: Turkish Spam Detector")
|
11 |
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.")
|
12 |
with col2:
|
13 |
+
text = placeholder.text_input("Enter the text you'd like to analyze for spam.", disabled=True, key="1")
|
14 |
+
aButton = placeholder2.button('Analyze', disabled=True, key="1")
|
15 |
if st.button('Load Model', disabled=False):
|
16 |
with st.spinner('Wait for it...'):
|
17 |
import torch
|
|
|
58 |
prediction = 'Spam' if np.argmax(output.logits.cpu().numpy()).flatten().item() == 1 else 'Normal'
|
59 |
pred = 'Predicted Class: '+ prediction
|
60 |
return pred
|
61 |
+
placeholder.text_input("Enter the text you'd like to analyze for spam.", disabled=False, key="2")
|
62 |
+
placeholder2.button('Analyze', disabled=False, key="2")
|
63 |
if not flag:
|
64 |
with col2:
|
65 |
if text or aButton:
|