Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -128,14 +128,35 @@ if (runModel=='1'):
|
|
128 |
# Evaluate the model
|
129 |
trainer.evaluate()
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
label_mapping = {
|
132 |
-
0: "
|
133 |
-
1: "
|
134 |
-
2: "
|
135 |
-
3: "
|
136 |
-
4: "
|
137 |
-
5: "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
|
|
139 |
|
140 |
def evaluate_and_report_errors(model, dataloader, tokenizer):
|
141 |
model.eval()
|
@@ -262,15 +283,36 @@ else:
|
|
262 |
#tokenizer = AutoTokenizer.from_pretrained(tokenizer_save_path)
|
263 |
|
264 |
#Define the label mappings (this must match the mapping used during training)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
label_mapping = {
|
266 |
-
0: "
|
267 |
-
1: "
|
268 |
-
2: "
|
269 |
-
3: "
|
270 |
-
4: "
|
271 |
-
5: "
|
272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
|
|
|
274 |
|
275 |
#Function to classify user input
|
276 |
def classifyTimeFrame(user_input):
|
|
|
128 |
# Evaluate the model
|
129 |
trainer.evaluate()
|
130 |
|
131 |
+
#label_mapping = {
|
132 |
+
#0: "lastmonth",
|
133 |
+
#1: "nextweek",
|
134 |
+
#2: "sevendays",
|
135 |
+
#3: "today",
|
136 |
+
#4: "tomorrow",
|
137 |
+
#5: "yesterday"
|
138 |
+
#}
|
139 |
label_mapping = {
|
140 |
+
0: "fivedays",
|
141 |
+
1: "fiveyears",
|
142 |
+
2: "fourdays",
|
143 |
+
3: "one-year",
|
144 |
+
4: "oneday",
|
145 |
+
5: "onemonth",
|
146 |
+
6: "sevendays",
|
147 |
+
7: "sixdays",
|
148 |
+
8: "tenyears",
|
149 |
+
9: "threedays",
|
150 |
+
10: "threeweeks",
|
151 |
+
11: "threemonths",
|
152 |
+
12: "thismonth",
|
153 |
+
13: "thisweek",
|
154 |
+
14: "twodays",
|
155 |
+
15: "twomonths",
|
156 |
+
16: "twoweeks",
|
157 |
+
|
158 |
}
|
159 |
+
|
160 |
|
161 |
def evaluate_and_report_errors(model, dataloader, tokenizer):
|
162 |
model.eval()
|
|
|
283 |
#tokenizer = AutoTokenizer.from_pretrained(tokenizer_save_path)
|
284 |
|
285 |
#Define the label mappings (this must match the mapping used during training)
|
286 |
+
|
287 |
+
#label_mapping = {
|
288 |
+
#0: "lastmonth",
|
289 |
+
#1: "nextweek",
|
290 |
+
#2: "sevendays",
|
291 |
+
#3: "today",
|
292 |
+
#4: "tomorrow",
|
293 |
+
#5: "yesterday"
|
294 |
+
#}
|
295 |
+
|
296 |
label_mapping = {
|
297 |
+
0: "fivedays",
|
298 |
+
1: "fiveyears",
|
299 |
+
2: "fourdays",
|
300 |
+
3: "one-year",
|
301 |
+
4: "oneday",
|
302 |
+
5: "onemonth",
|
303 |
+
6: "sevendays",
|
304 |
+
7: "sixdays",
|
305 |
+
8: "tenyears",
|
306 |
+
9: "threedays",
|
307 |
+
10: "threeweeks",
|
308 |
+
11: "threemonths",
|
309 |
+
12: "thismonth",
|
310 |
+
13: "thisweek",
|
311 |
+
14: "twodays",
|
312 |
+
15: "twomonths",
|
313 |
+
16: "twoweeks",
|
314 |
|
315 |
+
}
|
316 |
|
317 |
#Function to classify user input
|
318 |
def classifyTimeFrame(user_input):
|