rmdhirr commited on
Commit
a664f59
1 Parent(s): 209780d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -25,12 +25,12 @@ nltk.download('wordnet')
25
  STOPWORDS = set(stopwords.words('english'))
26
  lemmatizer = WordNetLemmatizer()
27
 
28
- def normalize_length(url, target_length=50):
29
- if len(url) < target_length:
30
- url = url + " " * (target_length - len(url))
31
  else:
32
- url = url[:target_length]
33
- return url
34
 
35
  def preprocess_url(url):
36
  url = url.lower()
@@ -86,8 +86,7 @@ def get_prediction(input_text, input_type):
86
 
87
  def phishing_detection(input_text, input_type):
88
  prediction = get_prediction(input_text, input_type)
89
- threshold = 0.5 # Adjusted threshold
90
- if prediction > threshold:
91
  return f"Warning: This site is likely a phishing site! ({prediction:.2f})"
92
  else:
93
  return f"Safe: This site is not likely a phishing site. ({prediction:.2f})"
@@ -104,4 +103,4 @@ iface = gr.Interface(
104
  theme="default"
105
  )
106
 
107
- iface.launch()
 
25
  STOPWORDS = set(stopwords.words('english'))
26
  lemmatizer = WordNetLemmatizer()
27
 
28
+ def normalize_length(text, target_length=50):
29
+ if len(text) < target_length:
30
+ text = text + " " * (target_length - len(text))
31
  else:
32
+ text = text[:target_length]
33
+ return text
34
 
35
  def preprocess_url(url):
36
  url = url.lower()
 
86
 
87
  def phishing_detection(input_text, input_type):
88
  prediction = get_prediction(input_text, input_type)
89
+ if prediction > 0.5:
 
90
  return f"Warning: This site is likely a phishing site! ({prediction:.2f})"
91
  else:
92
  return f"Safe: This site is not likely a phishing site. ({prediction:.2f})"
 
103
  theme="default"
104
  )
105
 
106
+ iface.launch()