Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,19 +42,25 @@ def get_content_score(text, top_intents):
|
|
| 42 |
score += 0.2
|
| 43 |
return min(score + 0.1, 1.0)
|
| 44 |
|
|
|
|
| 45 |
def generate_reply(input_text, intent):
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
# UI
|
| 60 |
st.set_page_config(page_title="Customer Support Assistant", layout="centered")
|
|
|
|
| 42 |
score += 0.2
|
| 43 |
return min(score + 0.1, 1.0)
|
| 44 |
|
| 45 |
+
# Updated reply generator with intent-specific follow-up
|
| 46 |
def generate_reply(input_text, intent):
|
| 47 |
+
# Defined intent-specific closing prompts
|
| 48 |
+
intent_closings = {
|
| 49 |
+
"top up balance": "Would you like to see recharge options and prices?",
|
| 50 |
+
"reactivate service": "Shall I help you reactivate your number now?",
|
| 51 |
+
"report service outage": "Would you like me to file a service report for you?",
|
| 52 |
+
"change mobile plan": "Need me to compare available plans for you?",
|
| 53 |
+
"ask for billing support": "Would you like me to check your latest bill details?",
|
| 54 |
+
"cancel subscription": "Should I guide you through the cancellation process?",
|
| 55 |
+
"check account status": "Would you like an overview of your account status?",
|
| 56 |
+
"upgrade device": "Would you like me to show available upgrade options?"
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
closing = intent_closings.get(intent.lower(), "Is there anything else I can help you with?")
|
| 60 |
+
opening = "Thanks for reaching out. I understand your concern."
|
| 61 |
+
action = f"Here's how we can assist with '{intent.lower()}'."
|
| 62 |
+
reply = f"{opening} {action} {closing}"
|
| 63 |
+
return reply
|
| 64 |
|
| 65 |
# UI
|
| 66 |
st.set_page_config(page_title="Customer Support Assistant", layout="centered")
|