ayeshaishaq004's picture
Update app.py
18d390b verified
raw
history blame
1.44 kB
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.')