NimaKL commited on
Commit
a6b7d4d
Β·
1 Parent(s): 4860c7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -3,13 +3,18 @@ from transformers import pipeline
3
  from textblob import TextBlob
4
  from transformers import BertForSequenceClassification, AdamW, BertConfig
5
 
 
 
 
 
 
 
 
 
 
6
 
7
 
8
 
9
- st.set_page_config(layout='wide', initial_sidebar_state='expanded')
10
- st.title("Spamd: Turkish Spam Detector")
11
- #st.markdown()
12
- text = st.text_input("Enter the text you'd like to analyze for spam.")
13
 
14
 
15
 
@@ -66,7 +71,8 @@ def predict(new_sentence):
66
 
67
  prediction = 'Spam' if np.argmax(output.logits.cpu().numpy()).flatten().item() == 1 else 'Normal'
68
  pred = 'Predicted Class: '+ prediction
69
- st.header(pred)
 
70
 
71
  #st.write('Input', namestr(new_sentence, globals()),': \n', new_sentence)
72
  # Remove the namestr(new_sentence, globals()) in case of an error
 
3
  from textblob import TextBlob
4
  from transformers import BertForSequenceClassification, AdamW, BertConfig
5
 
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
+
12
+ with col2:
13
+ st.set_page_config(layout='wide', initial_sidebar_state='expanded')
14
+ text = st.text_input("Enter the text you'd like to analyze for spam.")
15
 
16
 
17
 
 
 
 
 
18
 
19
 
20
 
 
71
 
72
  prediction = 'Spam' if np.argmax(output.logits.cpu().numpy()).flatten().item() == 1 else 'Normal'
73
  pred = 'Predicted Class: '+ prediction
74
+ with col2:
75
+ st.header(pred)
76
 
77
  #st.write('Input', namestr(new_sentence, globals()),': \n', new_sentence)
78
  # Remove the namestr(new_sentence, globals()) in case of an error