Spaces:
Runtime error
Runtime error
Commit
·
f1f8ba6
1
Parent(s):
75641e2
add further depends
Browse files- app.py +34 -0
- requirements.txt +2 -0
app.py
CHANGED
|
@@ -12,6 +12,40 @@ def get_pipe():
|
|
| 12 |
return pipe
|
| 13 |
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
def sort_predictions(predictions):
|
| 16 |
return sorted(predictions, key=lambda x: x['score'], reverse=True)
|
| 17 |
|
|
|
|
| 12 |
return pipe
|
| 13 |
|
| 14 |
|
| 15 |
+
|
| 16 |
+
@st.cache
|
| 17 |
+
def load_labels():
|
| 18 |
+
return [
|
| 19 |
+
"admiration",
|
| 20 |
+
"amusement",
|
| 21 |
+
"anger",
|
| 22 |
+
"annoyance",
|
| 23 |
+
"approval",
|
| 24 |
+
"caring",
|
| 25 |
+
"confusion",
|
| 26 |
+
"curiosity",
|
| 27 |
+
"desire",
|
| 28 |
+
"disappointment",
|
| 29 |
+
"disapproval",
|
| 30 |
+
"disgust",
|
| 31 |
+
"embarrassment",
|
| 32 |
+
"excitement",
|
| 33 |
+
"fear",
|
| 34 |
+
"gratitude",
|
| 35 |
+
"grief",
|
| 36 |
+
"joy",
|
| 37 |
+
"love",
|
| 38 |
+
"nervousness",
|
| 39 |
+
"optimism",
|
| 40 |
+
"pride",
|
| 41 |
+
"realization",
|
| 42 |
+
"relief",
|
| 43 |
+
"remorse",
|
| 44 |
+
"sadness",
|
| 45 |
+
"surprise",
|
| 46 |
+
"neutral"
|
| 47 |
+
]
|
| 48 |
+
|
| 49 |
def sort_predictions(predictions):
|
| 50 |
return sorted(predictions, key=lambda x: x['score'], reverse=True)
|
| 51 |
|
requirements.txt
CHANGED
|
@@ -2,3 +2,5 @@ nltk>=3.6.5
|
|
| 2 |
transformers
|
| 3 |
matplotlib
|
| 4 |
torch
|
|
|
|
|
|
|
|
|
| 2 |
transformers
|
| 3 |
matplotlib
|
| 4 |
torch
|
| 5 |
+
tqdm>=4.62.3
|
| 6 |
+
datasets>=1.16.1
|