Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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"
|
48 |
-
f"The
|
49 |
-
f"
|
|
|
|
|
|
|
|
|
50 |
)
|
51 |
-
|
|
|
|
|
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")
|