JoshuaZywoo commited on
Commit
d93adad
·
verified ·
1 Parent(s): 0443ecd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -44,11 +44,17 @@ def get_content_score(text, top_intents):
44
 
45
  def generate_reply(input_text, intent):
46
  prompt = (
47
- f"Write a professional customer service response to the following customer request: '{input_text}'\n"
48
- f"The request is related to: '{intent}'.\n"
49
- f"Start with a polite sentence, then provide a clear solution, and end with a kind question offering further help."
 
 
 
 
50
  )
51
- return text_generator(prompt)[0]['generated_text']
 
 
52
 
53
  # UI
54
  st.set_page_config(page_title="Customer Support Assistant", layout="centered")
 
44
 
45
  def generate_reply(input_text, intent):
46
  prompt = (
47
+ f"You are a telecom customer service agent. Based on the customer's message: '{input_text}'\n"
48
+ f"The detected issue is: '{intent}'.\n"
49
+ f"Generate a reply in 3 short sentences:\n"
50
+ f"1. Start with a polite sentence showing understanding.\n"
51
+ f"2. Offer a clear, actionable solution to the issue.\n"
52
+ f"3. End with a short, friendly question offering further help.\n"
53
+ f"Each sentence should be no more than 100 characters.\n"
54
  )
55
+ result = text_generator(prompt)[0]['generated_text']
56
+ cleaned = re.sub(r'(\. ){2,}', '. ', result)
57
+ return cleaned.strip()
58
 
59
  # UI
60
  st.set_page_config(page_title="Customer Support Assistant", layout="centered")