Spaces:
Runtime error
Runtime error
Update app.py
Browse files9 unmodified lines101112131415161718192021223 unmodified lines2627282930313233349 unmodified lines)# Label mapping (MUST match training)id_to_label = {0: "administrative_action",1: "attendance",2: "check_in",3: "clarification",4: "general_chat",5: "technical_help"}def classify_request(role, context, request):3 unmodified lines# Get highest scoring labelbest = max(outputs, key=lambda x: x["score"])return {"Predicted intent": best["label"],"Confidence": round(best["score"], 3)}9 unmodified lines101112131415161718192021223 unmodified lines26272829303132333435369 unmodified lines)# Label mapping (MUST match training)label_map = {"LABEL_0": "administrative_action","LABEL_1": "attendance","LABEL_2": "check_in","LABEL_3": "clarification","LABEL_4": "general_chat","LABEL_5": "technical_help"}def classify_request(role, context, request):3 unmodified lines# Get highest scoring labelbest = max(outputs, key=lambda x: x["score"])readable_label = label_map.get(best["label"], best["label"])return {"Predicted intent": readable_label,"Confidence": round(best["score"], 3)}
app.py+10-8