Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ lemmatizer = WordNetLemmatizer()
|
|
23 |
def preprocess_url(url):
|
24 |
url = url.lower() # Convert to lowercase
|
25 |
url = re.sub(r'https?://', '', url) # Remove http or https
|
26 |
-
url = re.sub(r'www
|
27 |
url = re.sub(r'[^a-zA-Z0-9]', ' ', url) # Remove special characters
|
28 |
url = re.sub(r'\s+', ' ', url).strip() # Remove extra spaces
|
29 |
tokens = word_tokenize(url) # Tokenize
|
@@ -86,23 +86,18 @@ interface = gr.Interface(
|
|
86 |
fn=predict_phishing,
|
87 |
inputs=[
|
88 |
gr.inputs.Textbox(label="URL"),
|
89 |
-
gr.inputs.Textbox(label="HTML Snippet")
|
90 |
],
|
91 |
outputs=[
|
92 |
gr.outputs.Textbox(label="Predicted Category"),
|
93 |
gr.outputs.Textbox(label="Predicted Probability")
|
94 |
],
|
95 |
title="Phishing Detection Model",
|
96 |
-
description="Enter a URL and its HTML content to predict if it's spam or legitimate.",
|
97 |
-
theme="
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
allow_replay=True, # Allow users to replay their inputs
|
102 |
-
allow_download=True, # Allow users to download inputs/outputs
|
103 |
-
allow_share=True, # Allow users to share the interface
|
104 |
-
show_comment=True, # Show comment section
|
105 |
-
comment_text="Note: It's recommended to input both URL and HTML for better accuracy." # Custom comment text
|
106 |
)
|
107 |
|
108 |
# Launch the Gradio interface
|
|
|
23 |
def preprocess_url(url):
|
24 |
url = url.lower() # Convert to lowercase
|
25 |
url = re.sub(r'https?://', '', url) # Remove http or https
|
26 |
+
url = re.sub(r'www\.', '', url) # Remove www
|
27 |
url = re.sub(r'[^a-zA-Z0-9]', ' ', url) # Remove special characters
|
28 |
url = re.sub(r'\s+', ' ', url).strip() # Remove extra spaces
|
29 |
tokens = word_tokenize(url) # Tokenize
|
|
|
86 |
fn=predict_phishing,
|
87 |
inputs=[
|
88 |
gr.inputs.Textbox(label="URL"),
|
89 |
+
gr.inputs.Textbox(label="HTML Snippet", lines=10, placeholder="Paste HTML content here")
|
90 |
],
|
91 |
outputs=[
|
92 |
gr.outputs.Textbox(label="Predicted Category"),
|
93 |
gr.outputs.Textbox(label="Predicted Probability")
|
94 |
],
|
95 |
title="Phishing Detection Model",
|
96 |
+
description="Enter a URL and its HTML content to predict if it's spam or legitimate. It's recommended to provide both for accurate results.",
|
97 |
+
theme="huggingface",
|
98 |
+
live=True,
|
99 |
+
css=".interface-container { border: 2px solid #4CAF50; border-radius: 10px; padding: 20px; }",
|
100 |
+
footer="Made with ❤️ by Ramadhirra"
|
|
|
|
|
|
|
|
|
|
|
101 |
)
|
102 |
|
103 |
# Launch the Gradio interface
|