Update app.py
Browse files
app.py
CHANGED
@@ -43,9 +43,8 @@ with col2:
|
|
43 |
|
44 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
45 |
#Used for printing the name if the variables. Removing it will not intrupt the project.
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
def predict(new_sentence):
|
50 |
# We need Token IDs and Attention Mask for inference on the new sentence
|
51 |
test_ids = []
|
@@ -66,11 +65,11 @@ with col2:
|
|
66 |
|
67 |
prediction = 'Spam' if np.argmax(output.logits.cpu().numpy()).flatten().item() == 1 else 'Normal'
|
68 |
pred = 'Predicted Class: '+ prediction
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
st.success("Model Loaded!")
|
71 |
|
72 |
-
|
73 |
-
st.header(pred)
|
74 |
-
text = st.text_input("Enter the text you'd like to analyze for spam.")
|
75 |
-
if text or st.button('Analyze'):
|
76 |
-
predict(text)
|
|
|
43 |
|
44 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
45 |
#Used for printing the name if the variables. Removing it will not intrupt the project.
|
46 |
+
|
47 |
+
st.success("Model Loaded!")
|
|
|
48 |
def predict(new_sentence):
|
49 |
# We need Token IDs and Attention Mask for inference on the new sentence
|
50 |
test_ids = []
|
|
|
65 |
|
66 |
prediction = 'Spam' if np.argmax(output.logits.cpu().numpy()).flatten().item() == 1 else 'Normal'
|
67 |
pred = 'Predicted Class: '+ prediction
|
68 |
+
with col2:
|
69 |
+
st.header(pred)
|
70 |
+
text = st.text_input("Enter the text you'd like to analyze for spam.")
|
71 |
+
if text or st.button('Analyze'):
|
72 |
+
predict(text)
|
73 |
|
|
|
74 |
|
75 |
+
|
|
|
|
|
|
|
|