Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,15 +49,22 @@ def get_emotion_score(emotion):
|
|
49 |
return 0.2
|
50 |
|
51 |
def generate_response(intent, human=True):
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
return result[0]['generated_text'].strip()
|
60 |
|
|
|
61 |
# App UI Setup
|
62 |
st.set_page_config(page_title="Smart Customer Support Assistant", layout="wide")
|
63 |
st.sidebar.title("📁 Customer Selector")
|
|
|
49 |
return 0.2
|
50 |
|
51 |
def generate_response(intent, human=True):
|
52 |
+
if human:
|
53 |
+
prompt = (
|
54 |
+
f"You are a telecom customer service agent. For the customer intent '{intent}', generate a professional 3-part response:\n"
|
55 |
+
"1. Greeting (e.g., Thank you for contacting us...)\n"
|
56 |
+
"2. Current plan summary (e.g., You're currently on Plan X at ¥X/month. We suggest Plan Y with XXGB for ¥Y/month.)\n"
|
57 |
+
"3. Close with a question (e.g., Would you like to switch?)"
|
58 |
+
)
|
59 |
+
else:
|
60 |
+
prompt = (
|
61 |
+
f"As a telecom assistant, generate a full 3-part structured response for customer intent: '{intent}'.\n"
|
62 |
+
"Include greeting, summary of their current plan and a better offer (fictional), and end with a follow-up question."
|
63 |
+
)
|
64 |
+
result = text_generator(prompt, max_new_tokens=120, do_sample=False)
|
65 |
return result[0]['generated_text'].strip()
|
66 |
|
67 |
+
|
68 |
# App UI Setup
|
69 |
st.set_page_config(page_title="Smart Customer Support Assistant", layout="wide")
|
70 |
st.sidebar.title("📁 Customer Selector")
|