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