Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,12 +25,12 @@ nltk.download('wordnet')
|
|
25 |
STOPWORDS = set(stopwords.words('english'))
|
26 |
lemmatizer = WordNetLemmatizer()
|
27 |
|
28 |
-
def normalize_length(
|
29 |
-
if len(
|
30 |
-
|
31 |
else:
|
32 |
-
|
33 |
-
return
|
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 |
-
|
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()
|