Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,13 @@ from sklearn.model_selection import train_test_split
|
|
| 10 |
from sklearn.metrics import classification_report, accuracy_score
|
| 11 |
import gradio as gr
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Define device
|
| 14 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 15 |
|
|
|
|
| 10 |
from sklearn.metrics import classification_report, accuracy_score
|
| 11 |
import gradio as gr
|
| 12 |
|
| 13 |
+
# Load dataset
|
| 14 |
+
file_path = 'spam_ham_dataset.csv'
|
| 15 |
+
df = pd.read_csv(file_path)
|
| 16 |
+
|
| 17 |
+
# Convert label column to numeric (0 for ham, 1 for spam)
|
| 18 |
+
df['label_num'] = df['label'].astype('category').cat.codes
|
| 19 |
+
|
| 20 |
# Define device
|
| 21 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 22 |
|