attaelahi commited on
Commit
0f26191
·
1 Parent(s): fc559aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,7 +1,8 @@
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- # Load the text classification model for spam detection
5
  classifier = pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-sms-spam-detection")
6
 
7
  def main():
@@ -18,5 +19,13 @@ def main():
18
  # Display the result
19
  st.write(f"**Result:** {result['label']} (Confidence: {result['score']:.2%})")
20
 
 
 
 
 
 
 
 
 
21
  if __name__ == "__main__":
22
  main()
 
1
+ # Filename: app.py
2
  import streamlit as st
3
  from transformers import pipeline
4
 
5
+ # Load a different text classification model for spam detection
6
  classifier = pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-sms-spam-detection")
7
 
8
  def main():
 
19
  # Display the result
20
  st.write(f"**Result:** {result['label']} (Confidence: {result['score']:.2%})")
21
 
22
+ # Show a message based on the classification
23
+ if result['label'] == 'spam':
24
+ st.error("This message is classified as spam.")
25
+ else:
26
+ st.success("This message is not spam.")
27
+ else:
28
+ st.warning("Please enter a message before checking for spam.")
29
+
30
  if __name__ == "__main__":
31
  main()