Spaces:
Runtime error
Runtime error
Jeffrey Rathgeber Jr
commited on
testmodel
Browse files
app.py
CHANGED
@@ -58,15 +58,15 @@ if option == 'MILESTONE 3':
|
|
58 |
# classifiers = [classifier_0, classifier_1, classifier_2, classifier_3, classifier_4, classifier_5]
|
59 |
|
60 |
X_train = [textIn]
|
61 |
-
|
62 |
|
63 |
with torch.no_grad():
|
64 |
-
outputs = model(**
|
65 |
predictions = F.softmax(outputs.logits, dim=1)
|
66 |
labels = torch.argmax(predictions, dim=1)
|
67 |
labels = [model.config.id2label[label_id] for label_id in labels.tolist()]
|
68 |
|
69 |
-
st.write(
|
70 |
|
71 |
|
72 |
col = ['Tweet', 'Highest_Toxicity_Class_Overall', 'Score_Overall', 'Highest_Toxicity_Class_Except_Toxic', 'Score_Except_Toxic']
|
|
|
58 |
# classifiers = [classifier_0, classifier_1, classifier_2, classifier_3, classifier_4, classifier_5]
|
59 |
|
60 |
X_train = [textIn]
|
61 |
+
batch_0 = tokenizer_0(X_train, padding=True, truncation=True, max_length=512, return_tensors="pt")
|
62 |
|
63 |
with torch.no_grad():
|
64 |
+
outputs = model(**batch_0, labels=torch.tensor([1, 0]))
|
65 |
predictions = F.softmax(outputs.logits, dim=1)
|
66 |
labels = torch.argmax(predictions, dim=1)
|
67 |
labels = [model.config.id2label[label_id] for label_id in labels.tolist()]
|
68 |
|
69 |
+
st.write(predictions['label'])
|
70 |
|
71 |
|
72 |
col = ['Tweet', 'Highest_Toxicity_Class_Overall', 'Score_Overall', 'Highest_Toxicity_Class_Except_Toxic', 'Score_Except_Toxic']
|