File size: 1,442 Bytes
a79a79d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18d390b
a79a79d
 
 
18d390b
a79a79d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import streamlit as st
import requests
from PIL import Image

# Streamlit app configuration
st.set_page_config(page_title='Phishing URL Detection', layout='centered')

# App Header
st.markdown("""
    <style>
    body { background-color: #f0f2f6; }
    .main { background-color: white; padding: 2rem; border-radius: 12px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
    </style>
""", unsafe_allow_html=True)

st.title('πŸ” Phishing URL Detection App')
st.write('Enter a URL to check if it is Phishing or Legitimate.')


# Input URL
url_input = st.text_input('Enter URL:', '')

# Hugging Face model endpoint
API_URL = 'https://huggingface.co/ayeshaishaq004/website-url-classifier/resolve/main/phishing_model.pkl'

if st.button('Check URL'):
    if url_input:
        try:
            # Sending URL to model for prediction
            response = requests.post(API_URL, json={'url': url_input})
            prediction = response.json().get('prediction', 'Error: Could not get prediction')

            if prediction == 'Phishing':
                st.error('🚨 This URL is likely a **Phishing Site**. Be careful!')
            elif prediction == 'Legitimate':
                st.success('βœ… This URL is likely **Legitimate**.')
            else:
                st.warning('⚠️ Unable to determine. Try again later.')

        except Exception as e:
            st.error(f'Error: {e}')
    else:
        st.warning('Please enter a valid URL.')