Spaces:
Runtime error
Runtime error
Commit
·
4f5dfd2
1
Parent(s):
9a67f9a
Update app.py
Browse files
app.py
CHANGED
@@ -72,7 +72,7 @@ def bulk_function(filename):
|
|
72 |
scores = (np.exp(predictions[0])/np.exp(predictions[0]).sum(-1,keepdims=True)).max(1)
|
73 |
|
74 |
# round scores
|
75 |
-
scores_rounded = [round(score,
|
76 |
|
77 |
# scores raw
|
78 |
temp = (np.exp(predictions[0])/np.exp(predictions[0]).sum(-1,keepdims=True))
|
@@ -97,7 +97,7 @@ def bulk_function(filename):
|
|
97 |
surprise.append(round(temp[i][6], 3))
|
98 |
|
99 |
# define df
|
100 |
-
df = pd.DataFrame(list(zip(ids,lines_s,labels,scores_rounded, anger, disgust, fear, joy, neutral, sadness, surprise)), columns=[df_input.columns[0], df_input.columns[1],'
|
101 |
print(df)
|
102 |
# save results to csv
|
103 |
YOUR_FILENAME = filename.name.split(".")[0] + "_emotion_predictions" + ".csv" # name your output file
|
|
|
72 |
scores = (np.exp(predictions[0])/np.exp(predictions[0]).sum(-1,keepdims=True)).max(1)
|
73 |
|
74 |
# round scores
|
75 |
+
scores_rounded = [round(score, 3) for score in scores]
|
76 |
|
77 |
# scores raw
|
78 |
temp = (np.exp(predictions[0])/np.exp(predictions[0]).sum(-1,keepdims=True))
|
|
|
97 |
surprise.append(round(temp[i][6], 3))
|
98 |
|
99 |
# define df
|
100 |
+
df = pd.DataFrame(list(zip(ids,lines_s,labels,scores_rounded, anger, disgust, fear, joy, neutral, sadness, surprise)), columns=[df_input.columns[0], df_input.columns[1],'max_label','max_score', 'anger', 'disgust', 'fear', 'joy', 'neutral', 'sadness', 'surprise'])
|
101 |
print(df)
|
102 |
# save results to csv
|
103 |
YOUR_FILENAME = filename.name.split(".")[0] + "_emotion_predictions" + ".csv" # name your output file
|