leygit commited on
Commit
4fd360a
·
verified ·
1 Parent(s): b995567

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -2
app.py CHANGED
@@ -158,6 +158,20 @@ def create_interface():
158
  with gr.Blocks() as interface:
159
  with gr.Tab("Demo"):
160
  gr.Markdown("Spam and Phishing Email Detection")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
 
162
  # Email Text Input
163
  email_input = gr.Textbox(
@@ -183,7 +197,17 @@ def create_interface():
183
  outputs=[result_output, confidence_output]
184
  )
185
 
186
- with gr.Tab("Analysis"):
 
 
 
 
 
 
 
 
 
 
187
  gr.Markdown("## 📊 Model Performance Analytics")
188
  with gr.Row():
189
  gr.Textbox(value=performance_metrics["accuracy"], label="Accuracy", interactive=False)
@@ -191,7 +215,7 @@ def create_interface():
191
  gr.Textbox(value=performance_metrics["recall"], label="Recall", interactive=False)
192
  gr.Textbox(value=performance_metrics["f1_score"], label="F1 Score", interactive=False)
193
 
194
- with gr.Tab("Background"):
195
  gr.Markdown(" ## Credits and Reference ")
196
 
197
  return interface
 
158
  with gr.Blocks() as interface:
159
  with gr.Tab("Demo"):
160
  gr.Markdown("Spam and Phishing Email Detection")
161
+ gr.Markdown(
162
+ """
163
+ Welcome to the Spam and Phishing Email Detection Demo! This tool leverages DistilBERT, a lightweight yet powerful transformer model, to classify emails as ham (legitimate), spam, or phishing based on their content.
164
+
165
+ To provide a comprehensive overview of the system, the demo is divided into three key sections:
166
+
167
+ Detection Demo – Input an email and see real-time classification results.
168
+
169
+ Metrics Analysis – Gain insights into the performance of the model, including accuracy, precision, recall, and F1-score.
170
+
171
+ Credits – Acknowledging the datasets, tools, and frameworks that made this project possible.
172
+ This project aims to enhance email security by identifying malicious messages with high accuracy, reducing the risk of scams and fraud. Feel free to explore the demo and see how AI is improving cybersecurity!
173
+ """)
174
+
175
 
176
  # Email Text Input
177
  email_input = gr.Textbox(
 
197
  outputs=[result_output, confidence_output]
198
  )
199
 
200
+ with gr.Tab("Analysis"):
201
+ with gr.Blocks() as interface:
202
+ gr.Markdown("## Dataset ")
203
+ # Top 10 words for spam
204
+ top_spam_words = get_top_words(df[df['label'] == "spam"]['text'], n=10)
205
+ gradio.Dataset(label="Top spam words:", top_spam_words)
206
+
207
+ # Top 10 words for ham
208
+ top_ham_words = get_top_words(df[df['label'] == "ham"]['text'], n=10)
209
+ gradio.Dataset(label="Top ham words:", top_ham_words)
210
+
211
  gr.Markdown("## 📊 Model Performance Analytics")
212
  with gr.Row():
213
  gr.Textbox(value=performance_metrics["accuracy"], label="Accuracy", interactive=False)
 
215
  gr.Textbox(value=performance_metrics["recall"], label="Recall", interactive=False)
216
  gr.Textbox(value=performance_metrics["f1_score"], label="F1 Score", interactive=False)
217
 
218
+ with gr.Tab("Glossary"):
219
  gr.Markdown(" ## Credits and Reference ")
220
 
221
  return interface