resolverkatla commited on
Commit
359ba9b
·
1 Parent(s): 7b0aeff
Files changed (3) hide show
  1. app.py +10 -2
  2. requirements.txt +2 -1
  3. spam.csv +0 -0
app.py CHANGED
@@ -1,12 +1,17 @@
1
  import gradio as gr
2
  from transformers import pipeline
 
3
 
4
- # Load the spam classifier model
 
 
 
 
5
  classifier = pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-sms-spam-detection")
6
 
7
  def spam_detector(text):
8
  result = classifier(text)
9
- return "Spam" if result[0]['label'] == 'spam' else "Not Spam"
10
 
11
  # Create Gradio UI
12
  app = gr.Interface(
@@ -19,4 +24,7 @@ app = gr.Interface(
19
 
20
  # Run the app
21
  if __name__ == "__main__":
 
 
22
  app.launch()
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
+ import pandas as pd
4
 
5
+ # Load dataset
6
+ DATASET_PATH = "spam.csv"
7
+ df = pd.read_csv(DATASET_PATH)
8
+
9
+ # Load a spam classification model
10
  classifier = pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-sms-spam-detection")
11
 
12
  def spam_detector(text):
13
  result = classifier(text)
14
+ return "Spam" if result[0]['label'].lower() == "spam" else "ham"
15
 
16
  # Create Gradio UI
17
  app = gr.Interface(
 
24
 
25
  # Run the app
26
  if __name__ == "__main__":
27
+ print("Loaded dataset preview:")
28
+ print(df.head())
29
  app.launch()
30
+
requirements.txt CHANGED
@@ -3,4 +3,5 @@ pipeline
3
  gradio
4
  tensorflow
5
  torch
6
- tf-keras
 
 
3
  gradio
4
  tensorflow
5
  torch
6
+ tf-keras
7
+ pandas
spam.csv ADDED
The diff for this file is too large to render. See raw diff