Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ from transformers import AutoTokenizer, AutoModel
|
|
| 12 |
|
| 13 |
ACTIONS = ["TRIP", "GITHUB", "MAIL"]
|
| 14 |
NUM_ACTIONS = len(ACTIONS)
|
| 15 |
-
DATASET_PATH =
|
| 16 |
|
| 17 |
# Confidence threshold - below this returns NONE
|
| 18 |
CONFIDENCE_THRESHOLD = 0.6
|
|
@@ -230,16 +230,15 @@ class RLAgent:
|
|
| 230 |
|
| 231 |
|
| 232 |
def load_dataset():
|
| 233 |
-
"""Load
|
| 234 |
-
|
| 235 |
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
data.append((user_msg, ACTIONS.index(label)))
|
| 243 |
|
| 244 |
random.shuffle(data)
|
| 245 |
return data
|
|
|
|
| 12 |
|
| 13 |
ACTIONS = ["TRIP", "GITHUB", "MAIL"]
|
| 14 |
NUM_ACTIONS = len(ACTIONS)
|
| 15 |
+
DATASET_PATH = "iteratehack/code19-dataset"
|
| 16 |
|
| 17 |
# Confidence threshold - below this returns NONE
|
| 18 |
CONFIDENCE_THRESHOLD = 0.6
|
|
|
|
| 230 |
|
| 231 |
|
| 232 |
def load_dataset():
|
| 233 |
+
"""Load dataset from Hugging Face Datasets."""
|
| 234 |
+
dataset = load_dataset(HF_DATASET, split=HF_SPLIT)
|
| 235 |
|
| 236 |
+
data = []
|
| 237 |
+
for item in dataset:
|
| 238 |
+
user_msg = item["messages"][1]["content"]
|
| 239 |
+
label = item["messages"][2]["content"]
|
| 240 |
+
if label in ACTIONS:
|
| 241 |
+
data.append((user_msg, ACTIONS.index(label)))
|
|
|
|
| 242 |
|
| 243 |
random.shuffle(data)
|
| 244 |
return data
|