Update app.py
Browse files
app.py
CHANGED
@@ -10,19 +10,18 @@ import io
|
|
10 |
import re
|
11 |
import os
|
12 |
|
13 |
-
# Embedded call center FAQs
|
14 |
csv_data = """question,answer,call_id,agent_id,timestamp,language
|
15 |
-
How do I reset my password
|
16 |
-
What are your pricing plans
|
17 |
-
How do I contact support
|
18 |
,,12348,A001,2025-04-01 10:22:00,en
|
19 |
-
How do I reset my password
|
20 |
-
help,Contact us
|
21 |
-
What is the refund policy
|
22 |
-
Invalid query
|
23 |
-
How do I update my billing
|
24 |
-
What are pricing plans
|
25 |
-
"""
|
26 |
|
27 |
# Data cleanup function
|
28 |
def clean_faqs(df):
|
@@ -71,7 +70,7 @@ def clean_faqs(df):
|
|
71 |
|
72 |
# Load and clean FAQs
|
73 |
try:
|
74 |
-
faq_data = pd.read_csv(io.StringIO(csv_data))
|
75 |
faq_data, cleanup_details = clean_faqs(faq_data)
|
76 |
except Exception as e:
|
77 |
raise Exception(f"Failed to load/clean FAQs: {str(e)}")
|
|
|
10 |
import re
|
11 |
import os
|
12 |
|
13 |
+
# Embedded call center FAQs (fixed formatting: escaped quotes, consistent rows, no trailing newline)
|
14 |
csv_data = """question,answer,call_id,agent_id,timestamp,language
|
15 |
+
"How do I reset my password?","Go to the login page, click ""Forgot Password,"" and follow the email instructions.",12345,A001,2025-04-01 10:15:23,en
|
16 |
+
"What are your pricing plans?","We offer Basic ($10/month), Pro ($50/month), and Enterprise (custom).",12346,A002,2025-04-01 10:17:45,en
|
17 |
+
"How do I contact support?","Email [email protected] or call +1-800-123-4567.",12347,A003,2025-04-01 10:20:10,en
|
18 |
,,12348,A001,2025-04-01 10:22:00,en
|
19 |
+
"How do I reset my password?","Duplicate answer.",12349,A002,2025-04-01 10:25:30,en
|
20 |
+
"help","Contact us.",12350,A004,2025-04-01 10:27:15,en
|
21 |
+
"What is the refund policy?","Refunds available within 30 days; contact support.",12351,A005,2025-04-01 10:30:00,es
|
22 |
+
"Invalid query!!!","N/A",12352,A006,2025-04-01 10:32:45,en
|
23 |
+
"How do I update my billing?","Log in, go to ""Billing,"" and update your payment method.",,A007,2025-04-01 10:35:10,en
|
24 |
+
"What are pricing plans?","Basic ($10/month), Pro ($50/month).",12353,A002,2025-04-01 10:37:20,en"""
|
|
|
25 |
|
26 |
# Data cleanup function
|
27 |
def clean_faqs(df):
|
|
|
70 |
|
71 |
# Load and clean FAQs
|
72 |
try:
|
73 |
+
faq_data = pd.read_csv(io.StringIO(csv_data), quotechar='"', escapechar='\\')
|
74 |
faq_data, cleanup_details = clean_faqs(faq_data)
|
75 |
except Exception as e:
|
76 |
raise Exception(f"Failed to load/clean FAQs: {str(e)}")
|