Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pickle
|
| 3 |
+
|
| 4 |
+
# Load the pre-trained phishing detection model from the .pkl file
|
| 5 |
+
with open('phishing (2).pkl', 'rb') as model_file:
|
| 6 |
+
phishing_model = pickle.load(model_file)
|
| 7 |
+
|
| 8 |
+
def is_phishing(url):
|
| 9 |
+
# Replace this with your actual prediction logic
|
| 10 |
+
# Example: You might need to preprocess the URL before making predictions
|
| 11 |
+
# prediction = phishing_model.predict(preprocess(url))
|
| 12 |
+
prediction = phishing_model.predict([url]) # Assuming the model expects a list of URLs
|
| 13 |
+
return prediction[0]
|
| 14 |
+
|
| 15 |
+
def main():
|
| 16 |
+
st.title('Phishing Detection App')
|
| 17 |
+
|
| 18 |
+
url = st.text_input('Enter URL:')
|
| 19 |
+
|
| 20 |
+
if st.button('Check for Phishing'):
|
| 21 |
+
result = is_phishing(url)
|
| 22 |
+
st.write(f'The URL is {"phishing" if result else "not phishing"}')
|
| 23 |
+
|
| 24 |
+
if __name__ == '__main__':
|
| 25 |
+
main()
|