Spaces:
Runtime error
Runtime error
Langdon commited on
Commit ·
78be115
1
Parent(s): 9f60a77
regex update for cite sources
Browse files
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
|
| 35 |
message = message.strip(" ':\"")
|
| 36 |
|
| 37 |
# Calculate the elapsed time
|
|
@@ -68,6 +68,14 @@ def feedback_response(
|
|
| 68 |
"Output": [bot_message],
|
| 69 |
"Time took in Seconds": [response_time],
|
| 70 |
"Feedback": [str(feedback)],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
"Additional Comments": [comments],
|
| 72 |
}
|
| 73 |
)
|
|
|
|
| 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 |
"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 |
)
|