jcho02 commited on
Commit
2762daa
1 Parent(s): f4344d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -13
app.py CHANGED
@@ -31,7 +31,7 @@ def get_initial_response(input_message):
31
  data = json.loads(response.text)
32
  message = data["message"]
33
  message = message.encode("utf-8").decode("unicode_escape")
34
- message = re.sub(r"^[\s'\"]*(bot)?[\s'\"]*(cite sources)?", "", message)
35
  message = message.strip(" ':\"")
36
 
37
  # Calculate the elapsed time
@@ -68,14 +68,6 @@ def feedback_response(
68
  "Output": [bot_message],
69
  "Time took in Seconds": [response_time],
70
  "Feedback": [str(feedback)],
71
- # Jaewoo, I'd prefer to have the feedback split into separate columns
72
- # You would need to update the spreadsheet for this. Some of the above
73
- # code could also be deleted.
74
- # "Primary Feedback": [feedback_primary],
75
- # "Informative": [True if any("Informative" in s for s in feedback_secondary) else False],
76
- # "Inaccurate": [True if any("Inaccurate" in s for s in feedback_secondary) else False],
77
- # "Nonsense": [True if any("Nonsense" in s for s in feedback_secondary) else False],
78
- # "Encoding": [True if any("Encoding" in s for s in feedback_secondary) else False],
79
  "Additional Comments": [comments],
80
  }
81
  )
@@ -83,8 +75,6 @@ def feedback_response(
83
  # Append the data to the worksheet
84
  worksheet.append_rows(df.values.tolist())
85
  gr.Info("Feedback Submitted")
86
-
87
- # Clear the feedback fields
88
  return {
89
  primary_feedback: None,
90
  secondary_feedback: None,
@@ -93,7 +83,7 @@ def feedback_response(
93
 
94
 
95
  with gr.Blocks(title="iTELL Chat Feedback") as feedback_interface:
96
- title = "iTELL Chat Safety Testing"
97
  gr.components.Markdown(
98
  f"<h1 style='text-align: center; margin-bottom: 1rem'>{title}</h1>"
99
  )
@@ -161,4 +151,4 @@ with gr.Blocks(title="iTELL Chat Feedback") as feedback_interface:
161
  )
162
 
163
  # Launch the interface
164
- feedback_interface.launch()
 
31
  data = json.loads(response.text)
32
  message = data["message"]
33
  message = message.encode("utf-8").decode("unicode_escape")
34
+ message = re.sub(r"^[\s'\"]*(bot|cite sources)?[\s'\"]*", "", message)
35
  message = message.strip(" ':\"")
36
 
37
  # Calculate the elapsed time
 
68
  "Output": [bot_message],
69
  "Time took in Seconds": [response_time],
70
  "Feedback": [str(feedback)],
 
 
 
 
 
 
 
 
71
  "Additional Comments": [comments],
72
  }
73
  )
 
75
  # Append the data to the worksheet
76
  worksheet.append_rows(df.values.tolist())
77
  gr.Info("Feedback Submitted")
 
 
78
  return {
79
  primary_feedback: None,
80
  secondary_feedback: None,
 
83
 
84
 
85
  with gr.Blocks(title="iTELL Chat Feedback") as feedback_interface:
86
+ title = "Itell Guide Response Bot"
87
  gr.components.Markdown(
88
  f"<h1 style='text-align: center; margin-bottom: 1rem'>{title}</h1>"
89
  )
 
151
  )
152
 
153
  # Launch the interface
154
+ feedback_interface.launch()