kithangw commited on
Commit
40fe464
·
verified ·
1 Parent(s): ab3d513

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -5,16 +5,16 @@ from transformers import pipeline
5
  classifier = pipeline("text-classification", model='kithangw/phishing_link_detection')
6
 
7
  # Streamlit application title
8
- st.title("Please enter a suspicious email")
9
 
10
- # Text input for user to enter the email to classify
11
- email = st.text_area("Enter the email to classify", "")
12
 
13
  # Perform text classification when the user clicks the "Classify" button
14
  if st.button("Classify"):
15
- if email: # Check if email is not empty
16
- # Perform text classification on the input email
17
- results = classifier(email)
18
 
19
  # The results variable contains a list with one item, which is a dictionary.
20
  # The dictionary has 'label' and 'score' as keys.
@@ -24,8 +24,8 @@ if st.button("Classify"):
24
 
25
  # Check the label and print out the corresponding message
26
  if label == "LABEL_1": # Assuming LABEL_1 indicates phishing
27
- st.write(f"The email you entered is {score}% likely to be a phishing email.")
28
  else: # Assuming LABEL_0 indicates not phishing
29
- st.write(f"The email you entered is {score}% likely to be not a phishing email.")
30
  else:
31
- st.error("Please enter an email to classify.")
 
5
  classifier = pipeline("text-classification", model='kithangw/phishing_link_detection')
6
 
7
  # Streamlit application title
8
+ st.title("Please enter a suspicious link")
9
 
10
+ # Text input for user to enter the link to classify
11
+ email = st.text_area("Enter the link to classify", "")
12
 
13
  # Perform text classification when the user clicks the "Classify" button
14
  if st.button("Classify"):
15
+ if link: # Check if link is not empty
16
+ # Perform text classification on the input link
17
+ results = classifier(link)
18
 
19
  # The results variable contains a list with one item, which is a dictionary.
20
  # The dictionary has 'label' and 'score' as keys.
 
24
 
25
  # Check the label and print out the corresponding message
26
  if label == "LABEL_1": # Assuming LABEL_1 indicates phishing
27
+ st.write(f"The link you entered is {score}% likely to be a phishing email.")
28
  else: # Assuming LABEL_0 indicates not phishing
29
+ st.write(f"The link you entered is {score}% likely to be not a phishing email.")
30
  else:
31
+ st.error("Please enter an link to classify.")