Jeffrey Rathgeber Jr commited on
Commit
fe3f137
1 Parent(s): 80319f9

test table

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -89,30 +89,30 @@ if option == 'MILESTONE 3':
89
 
90
 
91
 
92
- pred_data = []
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  for i in range(10):
95
- X_train = pre_populated_tweets[i]
96
- for j in range(6):
97
- batch = tokenizers[j](X_train, padding=True, truncation=True, max_length=512, return_tensors="pt")
98
- with torch.no_grad():
99
- outputs = models[j](**batch, labels=torch.tensor([1, 0]))
100
- predictions = F.softmax(outputs.logits, dim=1)
101
- labels = torch.argmax(predictions, dim=1)
102
- labels = [model.config.id2label[label_id] for label_id in labels.tolist()]
103
- pred_data.append(predictions)
104
-
105
- st.write(pred_data[0]['label'])
106
-
107
- for i in range(10):
108
- HTCO[i]=pred_data[i]['label']
109
-
110
- df = df.assign(Tweet=pre_populated_tweets)
111
- df = df.assign(Highest_Toxicity_Class_Overall=HTCO)
112
- df = df.assign(Score_Overall=SO)
113
- df = df.assign(Highest_Toxicity_Class_Except_Toxic=HTCET)
114
- df = df.assign(Score_Except_Toxic=SET)
115
-
116
  st.table(df)
117
 
118
  st.write('test2')
 
89
 
90
 
91
 
92
+ # pred_data = []
93
+
94
+ # for i in range(10):
95
+ # X_train = pre_populated_tweets[i]
96
+ # for j in range(6):
97
+ # batch = tokenizers[j](X_train, padding=True, truncation=True, max_length=512, return_tensors="pt")
98
+ # with torch.no_grad():
99
+ # outputs = models[j](**batch, labels=torch.tensor([1, 0]))
100
+ # predictions = F.softmax(outputs.logits, dim=1)
101
+ # labels = torch.argmax(predictions, dim=1)
102
+ # labels = [model.config.id2label[label_id] for label_id in labels.tolist()]
103
+ # pred_data.append(predictions)
104
+
105
+ # st.write(pred_data[0]['label'])
106
 
107
  for i in range(10):
108
+ HTCO[i]=pred_data[i]['label']
109
+
110
+ df = df.assign(Tweet=pre_populated_tweets)
111
+ df = df.assign(Highest_Toxicity_Class_Overall=HTCO)
112
+ df = df.assign(Score_Overall=SO)
113
+ df = df.assign(Highest_Toxicity_Class_Except_Toxic=HTCET)
114
+ df = df.assign(Score_Except_Toxic=SET)
115
+
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  st.table(df)
117
 
118
  st.write('test2')