tanish78 commited on
Commit
b747671
·
verified ·
1 Parent(s): ddc940b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -10,8 +10,9 @@ import matplotlib.pyplot as plt
10
  import plotly.express as px
11
  from PIL import Image
12
 
13
- # Define categories for Bot 1 and Bot 2
14
- categories_keywords_bot1 = {
 
15
  'Application Status': ['application', 'applied', 'update on my application', 'result of my application', 'selected', 'selection process', 'apply', 'fellow', 'lesson plan', 'status of my application', 'application update', 'application status', 'applied for'],
16
  'Volunteering': ['volunteering', 'volunteer', 'volunteering certificate', 'resume my volunteering', 'volunteering journey', 'volunteering with TFI', 'volunteering opportunities', 'volunteer work', 'volunteer program'],
17
  'Certificates': ['certificate', 'certificates', 'certificate of completion', 'volunteer certificate', 'issue certificate'],
@@ -26,11 +27,12 @@ categories_keywords_bot1 = {
26
  'Salary and Benefits': ['salary', 'increment', 'accommodation', 'training period', 'reside', 'stipend', 'pay', 'wage', 'salary details', 'benefits information'],
27
  'Technical Issues': ['network issues', 'zoom meeting', 'passcode', 'technical', 'issue','technical problem', 'system issue', 'technical support'],
28
  'Complaint Handling': ['help', 'i need help', 'Help me', 'complaint', 'issue is unresolved', 'unsatisfied', 'bad experience'],
 
29
  'End of Conversation': ['thanks', 'thankss', 'thank u', 'thank you', 'ok', 'okay', 'done', 'joining', 'sounds good', 'goodbye', 'end chat', 'end'],
30
  'Miscellaneous': []
31
  }
32
 
33
- categories_keywords_bot2 = {
34
  'Service Issues': ['service', 'support', 'help', 'assistance'],
35
  'Billing': ['bill', 'billing', 'invoice', 'payment', 'charge'],
36
  'Technical Problems': ['technical', 'error', 'problem', 'issue'],
@@ -40,7 +42,7 @@ categories_keywords_bot2 = {
40
  }
41
 
42
  # Initialize with Bot 1's categories
43
- categories_keywords = categories_keywords_bot1
44
 
45
  def categorize_question(question, categories_keywords):
46
  for category, keywords in categories_keywords.items():
@@ -169,10 +171,10 @@ def generate_bar_chart(df, num_clusters_to_display):
169
  def main(file, bot_name, num_clusters_to_display):
170
  try:
171
  global categories_keywords
172
- if bot_name == "Bot 1":
173
- categories_keywords = categories_keywords_bot1
174
  else:
175
- categories_keywords = categories_keywords_bot2
176
 
177
  df = pd.read_csv(file.name)
178
 
@@ -208,7 +210,7 @@ def categorize_unanswered_queries(bot_name, file, num_clusters_to_display):
208
  interface = gr.Interface(
209
  fn=categorize_unanswered_queries,
210
  inputs=[
211
- gr.Radio(["Bot 1", "Bot 2"], label="Select Bot"),
212
  gr.File(label="Upload CSV File (.csv)"),
213
  gr.Slider(label="Number of Categories to Display", minimum=1, maximum=10, step=1, value=5)
214
  ],
 
10
  import plotly.express as px
11
  from PIL import Image
12
 
13
+ # Define categories for Teach For India Bot and Firki
14
+ categories_keywords_tfi = {
15
+ 'Start of Conversation': ['hi', 'hello', 'hi I have a query', 'query', 'good morning', 'good afternoon', 'good evening'],
16
  'Application Status': ['application', 'applied', 'update on my application', 'result of my application', 'selected', 'selection process', 'apply', 'fellow', 'lesson plan', 'status of my application', 'application update', 'application status', 'applied for'],
17
  'Volunteering': ['volunteering', 'volunteer', 'volunteering certificate', 'resume my volunteering', 'volunteering journey', 'volunteering with TFI', 'volunteering opportunities', 'volunteer work', 'volunteer program'],
18
  'Certificates': ['certificate', 'certificates', 'certificate of completion', 'volunteer certificate', 'issue certificate'],
 
27
  'Salary and Benefits': ['salary', 'increment', 'accommodation', 'training period', 'reside', 'stipend', 'pay', 'wage', 'salary details', 'benefits information'],
28
  'Technical Issues': ['network issues', 'zoom meeting', 'passcode', 'technical', 'issue','technical problem', 'system issue', 'technical support'],
29
  'Complaint Handling': ['help', 'i need help', 'Help me', 'complaint', 'issue is unresolved', 'unsatisfied', 'bad experience'],
30
+ 'User Feedback': ['feedback', 'loved', 'dissapointed', 'hated', 'it was good', 'it was bad', 'helpful',],
31
  'End of Conversation': ['thanks', 'thankss', 'thank u', 'thank you', 'ok', 'okay', 'done', 'joining', 'sounds good', 'goodbye', 'end chat', 'end'],
32
  'Miscellaneous': []
33
  }
34
 
35
+ categories_keywords_firki = {
36
  'Service Issues': ['service', 'support', 'help', 'assistance'],
37
  'Billing': ['bill', 'billing', 'invoice', 'payment', 'charge'],
38
  'Technical Problems': ['technical', 'error', 'problem', 'issue'],
 
42
  }
43
 
44
  # Initialize with Bot 1's categories
45
+ categories_keywords = categories_keywords_tfi
46
 
47
  def categorize_question(question, categories_keywords):
48
  for category, keywords in categories_keywords.items():
 
171
  def main(file, bot_name, num_clusters_to_display):
172
  try:
173
  global categories_keywords
174
+ if bot_name == "Teach For India":
175
+ categories_keywords = categories_keywords_tfi
176
  else:
177
+ categories_keywords = categories_keywords_firki
178
 
179
  df = pd.read_csv(file.name)
180
 
 
210
  interface = gr.Interface(
211
  fn=categorize_unanswered_queries,
212
  inputs=[
213
+ gr.Radio(["Teach For India", "Firki"], label="Select ChatBot"),
214
  gr.File(label="Upload CSV File (.csv)"),
215
  gr.Slider(label="Number of Categories to Display", minimum=1, maximum=10, step=1, value=5)
216
  ],