King-8 commited on
Commit
03a7225
·
verified ·
1 Parent(s): 70bdb05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -10,13 +10,13 @@ classifier = pipeline(
10
  )
11
 
12
  # Label mapping (MUST match training)
13
- id_to_label = {
14
- 0: "administrative_action",
15
- 1: "attendance",
16
- 2: "check_in",
17
- 3: "clarification",
18
- 4: "general_chat",
19
- 5: "technical_help"
20
  }
21
 
22
  def classify_request(role, context, request):
@@ -26,9 +26,11 @@ def classify_request(role, context, request):
26
 
27
  # Get highest scoring label
28
  best = max(outputs, key=lambda x: x["score"])
 
 
29
 
30
  return {
31
- "Predicted intent": best["label"],
32
  "Confidence": round(best["score"], 3)
33
  }
34
 
 
10
  )
11
 
12
  # Label mapping (MUST match training)
13
+ label_map = {
14
+ "LABEL_0": "administrative_action",
15
+ "LABEL_1": "attendance",
16
+ "LABEL_2": "check_in",
17
+ "LABEL_3": "clarification",
18
+ "LABEL_4": "general_chat",
19
+ "LABEL_5": "technical_help"
20
  }
21
 
22
  def classify_request(role, context, request):
 
26
 
27
  # Get highest scoring label
28
  best = max(outputs, key=lambda x: x["score"])
29
+
30
+ readable_label = label_map.get(best["label"], best["label"])
31
 
32
  return {
33
+ "Predicted intent": readable_label,
34
  "Confidence": round(best["score"], 3)
35
  }
36