Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ def preprocess_html(html):
|
|
44 |
return ' '.join(tokens)
|
45 |
|
46 |
# Load trained model
|
47 |
-
model = keras.models.load_model('
|
48 |
|
49 |
# Define maximum length and number of words
|
50 |
max_url_length = 180
|
@@ -74,7 +74,7 @@ def predict_phishing(url, html):
|
|
74 |
new_html_padded = pad_sequences(new_html_sequences, maxlen=max_html_length, padding='post', truncating='post')
|
75 |
|
76 |
new_predictions_prob = model.predict([new_url_padded, new_html_padded])
|
77 |
-
new_predictions = (new_predictions_prob > 0.
|
78 |
|
79 |
predicted_category = label_encoder.inverse_transform(new_predictions)[0]
|
80 |
predicted_probability = f"{new_predictions_prob[0][0]:.4f}"
|
|
|
44 |
return ' '.join(tokens)
|
45 |
|
46 |
# Load trained model
|
47 |
+
model = keras.models.load_model('new_phishing_detection_model.keras')
|
48 |
|
49 |
# Define maximum length and number of words
|
50 |
max_url_length = 180
|
|
|
74 |
new_html_padded = pad_sequences(new_html_sequences, maxlen=max_html_length, padding='post', truncating='post')
|
75 |
|
76 |
new_predictions_prob = model.predict([new_url_padded, new_html_padded])
|
77 |
+
new_predictions = (new_predictions_prob > 0.6).astype(int) # Adjust threshold if needed
|
78 |
|
79 |
predicted_category = label_encoder.inverse_transform(new_predictions)[0]
|
80 |
predicted_probability = f"{new_predictions_prob[0][0]:.4f}"
|