attaelahi commited on
Commit
3f7144c
·
1 Parent(s): d63a3d4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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():
8
+ st.title("Spam Detection App")
9
+
10
+ # Text input for user to enter a message
11
+ user_input = st.text_input("Enter a message:")
12
+
13
+ if st.button("Check for Spam"):
14
+ if user_input:
15
+ # Use the loaded model to classify the user's input
16
+ result = classifier(user_input)[0]
17
+
18
+ # Display the result
19
+ st.write(f"**Result:** {result['label']} (Confidence: {result['score']:.2%})")
20
+
21
+ if __name__ == "__main__":
22
+ main()