JoshuaZywoo commited on
Commit
07994df
·
verified ·
1 Parent(s): 80c829c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
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
- prompt = (
53
- f"You are a telecom customer service assistant. For the customer intent '{intent}', generate a 3-part response:\n"
54
- "[Greeting: polite welcome.]\n"
55
- "[Middle: mention the customer is currently on Plan X (¥X/month), and suggest switching to Plan Y with XXGB at ¥Y/month. Use fictional placeholder values.]\n"
56
- "[End: ask if they'd like to proceed with the new plan or need more details.]"
57
- )
58
- result = text_generator(prompt, max_new_tokens=100, do_sample=False)
 
 
 
 
 
 
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")