Paperbag commited on
Commit
01626e9
·
1 Parent(s): d980e51

feat: add stdout encoding handling, enhance answer normalization, and update CSV and JSON results

Browse files
99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b218c951c1f888f0bbe6f46c080f57afc7c9348fffc7ba4da35749ff1e2ac40f
3
+ size 179304
app.py CHANGED
@@ -1,4 +1,8 @@
1
  import os
 
 
 
 
2
  import re
3
  import gradio as gr
4
  import requests
@@ -46,8 +50,9 @@ def extract_answer(content) -> str:
46
  def normalize_answer(s: str) -> str:
47
  s = s.strip().lower()
48
  s = re.sub(r'^[\$€£¥]+', '', s)
49
- s = re.sub(r'[.,!?;:]+$', '', s)
50
  s = s.replace(',', ' ')
 
51
  s = re.sub(r'\s+', ' ', s)
52
  s = re.sub(r'^(a |an |the )', '', s)
53
  s = s.rstrip('*')
 
1
  import os
2
+ import sys
3
+ import io
4
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
5
+
6
  import re
7
  import gradio as gr
8
  import requests
 
50
  def normalize_answer(s: str) -> str:
51
  s = s.strip().lower()
52
  s = re.sub(r'^[\$€£¥]+', '', s)
53
+ s = re.sub(r'\.+$', '', s)
54
  s = s.replace(',', ' ')
55
+ s = re.sub(r'(?<=\d)\s+(?=\d)', '', s)
56
  s = re.sub(r'\s+', ' ', s)
57
  s = re.sub(r'^(a |an |the )', '', s)
58
  s = s.rstrip('*')
gaia_results.csv CHANGED
@@ -1,5 +1,5 @@
1
  task_id,question,submitted_answer,ground_truth,correct
2
- 8e867cd7-cff9-4e6c-867a-ff5ddc2550be,How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.,,3,False
3
  a1e91b78-d3d8-4675-bb8d-62741b4b68a6,"In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?",,3,False
4
  2d83110e-a098-4ebb-9987-066c06fa42d0,".rewsna eht sa ""tfel"" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI",right,Right,True
5
  cca530fc-4052-43b2-b130-b30968d8aa44,Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.,,Rd5,False
@@ -14,23 +14,23 @@ cca530fc-4052-43b2-b130-b30968d8aa44,Review the chess position provided in the i
14
  |d|b|e|b|e|d|
15
  |e|d|b|a|d|c|
16
 
17
- provide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.","b,e","b, e",False
18
  9d191bce-651d-4746-be2d-7ef8ecadb9c2,"Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.
19
 
20
- What does Teal'c say in response to the question ""Isn't that hot?""","Teal'c responds with **""Indeed.""**",Extremely,False
21
  cabe07ed-9eca-40ea-8ead-410ef5e83f91,What is the surname of the equine veterinarian mentioned in 1.E Exercises from the chemistry materials licensed by Marisa Alviar-Agnew & Henry Agnew under the CK-12 license in LibreText's Introductory Chemistry materials as compiled 08/21/2023?,,Louvrier,False
22
  3cef3a44-215e-4aed-8e3b-b1e3f08063b7,"I'm making a grocery list for my mom, but she's a professor of botany and she's a real stickler when it comes to categorizing things. I need to add different foods to different categories on the grocery list, but if I make a mistake, she won't buy anything inserted in the wrong category. Here's the list I have so far:
23
 
24
  milk, eggs, flour, whole bean coffee, Oreos, sweet potatoes, fresh basil, plums, green beans, rice, corn, bell pepper, whole allspice, acorns, broccoli, celery, zucchini, lettuce, peanuts
25
 
26
- I need to make headings for the fruits and vegetables. Could you please create a list of just the vegetables from my list? If you could do that, then I can figure out how to categorize the rest of the list into the appropriate categories. But remember that my mom is a real stickler, so make sure that no botanical fruits end up on the vegetable list, or she won't get them when she's at the store. Please alphabetize the list of vegetables, and place each item in a comma separated list.","broccoli, celery, fresh basil, lettuce, sweet potatoes","broccoli, celery, fresh basil, lettuce, sweet potatoes",True
27
  99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3,"Hi, I'm making a pie but I could use some help with my shopping list. I have everything I need for the crust, but I'm not sure about the filling. I got the recipe from my friend Aditi, but she left it as a voice memo and the speaker on my phone is buzzing so I can't quite make out what she's saying. Could you please listen to the recipe and list all of the ingredients that my friend described? I only want the ingredients for the filling, as I have everything I need to make my favorite pie crust. I've attached the recipe as Strawberry pie.mp3.
28
 
29
  In your response, please only list the ingredients, not any measurements. So if the recipe calls for ""a pinch of salt"" or ""two cups of ripe strawberries"" the ingredients on the list would be ""salt"" and ""ripe strawberries"".
30
 
31
  Please format your response as a comma separated list of ingredients. Also, please alphabetize the ingredients.",,"cornstarch, freshly squeezed lemon juice, granulated sugar, pure vanilla extract, ripe strawberries",False
32
  305ac316-eef6-4446-960a-92d80d542f82,Who did the actor who played Ray in the Polish-language version of Everybody Loves Raymond play in Magda M.? Give only the first name.,,Wojciech,False
33
- f918266a-b3e0-4914-865d-4faa564f1aef,What is the final numeric output from the attached Python code?,,0,False
34
  3f57289b-8c60-48be-bd80-01f8099ca449,How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?,,519,False
35
  1f975693-876d-457b-a649-393859e79bf3,"Hi, I was out sick from my classes on Friday, so I'm trying to figure out what I need to study for my Calculus mid-term next week. My friend from class sent me an audio recording of Professor Willowbrook giving out the recommended reading for the test, but my headphones are broken :(
36
 
@@ -40,4 +40,4 @@ bda648d7-d618-4883-88f4-3466eabd860e,Where were the Vietnamese specimens describ
40
  cf106601-ab4f-4af9-b045-5295fe67b37d,"What country had the least number of athletes at the 1928 Summer Olympics? If there's a tie for a number of athletes, return the first in alphabetical order. Give the IOC country code as your answer.",CUB,CUB,True
41
  a0c07678-e491-4bbc-8f0b-07405144218f,"Who are the pitchers with the number before and after Taishō Tamai's number as of July 2023? Give them to me in the form Pitcher Before, Pitcher After, use their last names only, in Roman characters.",ERROR: 'charmap' codec can't encode character '\u014d' in position 55: character maps to <undefined>,"Yoshida, Uehara",False
42
  7bd855d8-463d-4ed5-93ca-5fe35145f733,The attached Excel file contains the sales of menu items for a local fast-food chain. What were the total sales that the chain made from food (not including drinks)? Express your answer in USD with two decimal places.,89706.00,89706.00,True
43
- 5a0c1adf-205e-4841-a666-7c3ef95def9d,What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?,,Claus,False
 
1
  task_id,question,submitted_answer,ground_truth,correct
2
+ 8e867cd7-cff9-4e6c-867a-ff5ddc2550be,How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.,We'll take the text we have from wiki_page (which we stored? Not stored as variable). We need to,3,False
3
  a1e91b78-d3d8-4675-bb8d-62741b4b68a6,"In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?",,3,False
4
  2d83110e-a098-4ebb-9987-066c06fa42d0,".rewsna eht sa ""tfel"" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI",right,Right,True
5
  cca530fc-4052-43b2-b130-b30968d8aa44,Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.,,Rd5,False
 
14
  |d|b|e|b|e|d|
15
  |e|d|b|a|d|c|
16
 
17
+ provide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.","b,e","b, e",True
18
  9d191bce-651d-4746-be2d-7ef8ecadb9c2,"Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.
19
 
20
+ What does Teal'c say in response to the question ""Isn't that hot?""",,Extremely,False
21
  cabe07ed-9eca-40ea-8ead-410ef5e83f91,What is the surname of the equine veterinarian mentioned in 1.E Exercises from the chemistry materials licensed by Marisa Alviar-Agnew & Henry Agnew under the CK-12 license in LibreText's Introductory Chemistry materials as compiled 08/21/2023?,,Louvrier,False
22
  3cef3a44-215e-4aed-8e3b-b1e3f08063b7,"I'm making a grocery list for my mom, but she's a professor of botany and she's a real stickler when it comes to categorizing things. I need to add different foods to different categories on the grocery list, but if I make a mistake, she won't buy anything inserted in the wrong category. Here's the list I have so far:
23
 
24
  milk, eggs, flour, whole bean coffee, Oreos, sweet potatoes, fresh basil, plums, green beans, rice, corn, bell pepper, whole allspice, acorns, broccoli, celery, zucchini, lettuce, peanuts
25
 
26
+ I need to make headings for the fruits and vegetables. Could you please create a list of just the vegetables from my list? If you could do that, then I can figure out how to categorize the rest of the list into the appropriate categories. But remember that my mom is a real stickler, so make sure that no botanical fruits end up on the vegetable list, or she won't get them when she's at the store. Please alphabetize the list of vegetables, and place each item in a comma separated list.","broccoli, celery, fresh basil, lettuce, sweet potato","broccoli, celery, fresh basil, lettuce, sweet potatoes",False
27
  99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3,"Hi, I'm making a pie but I could use some help with my shopping list. I have everything I need for the crust, but I'm not sure about the filling. I got the recipe from my friend Aditi, but she left it as a voice memo and the speaker on my phone is buzzing so I can't quite make out what she's saying. Could you please listen to the recipe and list all of the ingredients that my friend described? I only want the ingredients for the filling, as I have everything I need to make my favorite pie crust. I've attached the recipe as Strawberry pie.mp3.
28
 
29
  In your response, please only list the ingredients, not any measurements. So if the recipe calls for ""a pinch of salt"" or ""two cups of ripe strawberries"" the ingredients on the list would be ""salt"" and ""ripe strawberries"".
30
 
31
  Please format your response as a comma separated list of ingredients. Also, please alphabetize the ingredients.",,"cornstarch, freshly squeezed lemon juice, granulated sugar, pure vanilla extract, ripe strawberries",False
32
  305ac316-eef6-4446-960a-92d80d542f82,Who did the actor who played Ray in the Polish-language version of Everybody Loves Raymond play in Magda M.? Give only the first name.,,Wojciech,False
33
+ f918266a-b3e0-4914-865d-4faa564f1aef,What is the final numeric output from the attached Python code?,0,0,True
34
  3f57289b-8c60-48be-bd80-01f8099ca449,How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?,,519,False
35
  1f975693-876d-457b-a649-393859e79bf3,"Hi, I was out sick from my classes on Friday, so I'm trying to figure out what I need to study for my Calculus mid-term next week. My friend from class sent me an audio recording of Professor Willowbrook giving out the recommended reading for the test, but my headphones are broken :(
36
 
 
40
  cf106601-ab4f-4af9-b045-5295fe67b37d,"What country had the least number of athletes at the 1928 Summer Olympics? If there's a tie for a number of athletes, return the first in alphabetical order. Give the IOC country code as your answer.",CUB,CUB,True
41
  a0c07678-e491-4bbc-8f0b-07405144218f,"Who are the pitchers with the number before and after Taishō Tamai's number as of July 2023? Give them to me in the form Pitcher Before, Pitcher After, use their last names only, in Roman characters.",ERROR: 'charmap' codec can't encode character '\u014d' in position 55: character maps to <undefined>,"Yoshida, Uehara",False
42
  7bd855d8-463d-4ed5-93ca-5fe35145f733,The attached Excel file contains the sales of menu items for a local fast-food chain. What were the total sales that the chain made from food (not including drinks)? Express your answer in USD with two decimal places.,89706.00,89706.00,True
43
+ 5a0c1adf-205e-4841-a666-7c3ef95def9d,What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?,Claus,Claus,True
gaia_results.json CHANGED
@@ -1,12 +1,12 @@
1
  {
2
- "score": 20.0,
3
- "correct": 4,
4
  "total": 20,
5
  "results": [
6
  {
7
  "task_id": "8e867cd7-cff9-4e6c-867a-ff5ddc2550be",
8
  "question": "How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.",
9
- "submitted_answer": "",
10
  "ground_truth": "3",
11
  "correct": false
12
  },
@@ -43,12 +43,12 @@
43
  "question": "Given this table defining * on the set S = {a, b, c, d, e}\n\n|*|a|b|c|d|e|\n|---|---|---|---|---|---|\n|a|a|b|c|b|d|\n|b|b|c|a|e|c|\n|c|c|a|b|b|a|\n|d|b|e|b|e|d|\n|e|d|b|a|d|c|\n\nprovide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.",
44
  "submitted_answer": "b,e",
45
  "ground_truth": "b, e",
46
- "correct": false
47
  },
48
  {
49
  "task_id": "9d191bce-651d-4746-be2d-7ef8ecadb9c2",
50
  "question": "Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.\n\nWhat does Teal'c say in response to the question \"Isn't that hot?\"",
51
- "submitted_answer": "Teal'c responds with **\"Indeed.\"**",
52
  "ground_truth": "Extremely",
53
  "correct": false
54
  },
@@ -62,9 +62,9 @@
62
  {
63
  "task_id": "3cef3a44-215e-4aed-8e3b-b1e3f08063b7",
64
  "question": "I'm making a grocery list for my mom, but she's a professor of botany and she's a real stickler when it comes to categorizing things. I need to add different foods to different categories on the grocery list, but if I make a mistake, she won't buy anything inserted in the wrong category. Here's the list I have so far:\n\nmilk, eggs, flour, whole bean coffee, Oreos, sweet potatoes, fresh basil, plums, green beans, rice, corn, bell pepper, whole allspice, acorns, broccoli, celery, zucchini, lettuce, peanuts\n\nI need to make headings for the fruits and vegetables. Could you please create a list of just the vegetables from my list? If you could do that, then I can figure out how to categorize the rest of the list into the appropriate categories. But remember that my mom is a real stickler, so make sure that no botanical fruits end up on the vegetable list, or she won't get them when she's at the store. Please alphabetize the list of vegetables, and place each item in a comma separated list.",
65
- "submitted_answer": "broccoli, celery, fresh basil, lettuce, sweet potatoes",
66
  "ground_truth": "broccoli, celery, fresh basil, lettuce, sweet potatoes",
67
- "correct": true
68
  },
69
  {
70
  "task_id": "99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3",
@@ -83,9 +83,9 @@
83
  {
84
  "task_id": "f918266a-b3e0-4914-865d-4faa564f1aef",
85
  "question": "What is the final numeric output from the attached Python code?",
86
- "submitted_answer": "",
87
  "ground_truth": "0",
88
- "correct": false
89
  },
90
  {
91
  "task_id": "3f57289b-8c60-48be-bd80-01f8099ca449",
@@ -139,9 +139,9 @@
139
  {
140
  "task_id": "5a0c1adf-205e-4841-a666-7c3ef95def9d",
141
  "question": "What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?",
142
- "submitted_answer": "",
143
  "ground_truth": "Claus",
144
- "correct": false
145
  }
146
  ]
147
  }
 
1
  {
2
+ "score": 30.0,
3
+ "correct": 6,
4
  "total": 20,
5
  "results": [
6
  {
7
  "task_id": "8e867cd7-cff9-4e6c-867a-ff5ddc2550be",
8
  "question": "How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.",
9
+ "submitted_answer": "We'll take the text we have from wiki_page (which we stored? Not stored as variable). We need to",
10
  "ground_truth": "3",
11
  "correct": false
12
  },
 
43
  "question": "Given this table defining * on the set S = {a, b, c, d, e}\n\n|*|a|b|c|d|e|\n|---|---|---|---|---|---|\n|a|a|b|c|b|d|\n|b|b|c|a|e|c|\n|c|c|a|b|b|a|\n|d|b|e|b|e|d|\n|e|d|b|a|d|c|\n\nprovide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.",
44
  "submitted_answer": "b,e",
45
  "ground_truth": "b, e",
46
+ "correct": true
47
  },
48
  {
49
  "task_id": "9d191bce-651d-4746-be2d-7ef8ecadb9c2",
50
  "question": "Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.\n\nWhat does Teal'c say in response to the question \"Isn't that hot?\"",
51
+ "submitted_answer": "",
52
  "ground_truth": "Extremely",
53
  "correct": false
54
  },
 
62
  {
63
  "task_id": "3cef3a44-215e-4aed-8e3b-b1e3f08063b7",
64
  "question": "I'm making a grocery list for my mom, but she's a professor of botany and she's a real stickler when it comes to categorizing things. I need to add different foods to different categories on the grocery list, but if I make a mistake, she won't buy anything inserted in the wrong category. Here's the list I have so far:\n\nmilk, eggs, flour, whole bean coffee, Oreos, sweet potatoes, fresh basil, plums, green beans, rice, corn, bell pepper, whole allspice, acorns, broccoli, celery, zucchini, lettuce, peanuts\n\nI need to make headings for the fruits and vegetables. Could you please create a list of just the vegetables from my list? If you could do that, then I can figure out how to categorize the rest of the list into the appropriate categories. But remember that my mom is a real stickler, so make sure that no botanical fruits end up on the vegetable list, or she won't get them when she's at the store. Please alphabetize the list of vegetables, and place each item in a comma separated list.",
65
+ "submitted_answer": "broccoli, celery, fresh basil, lettuce, sweet potato",
66
  "ground_truth": "broccoli, celery, fresh basil, lettuce, sweet potatoes",
67
+ "correct": false
68
  },
69
  {
70
  "task_id": "99c9cc74-fdc8-46c6-8f8d-3ce2d3bfeea3",
 
83
  {
84
  "task_id": "f918266a-b3e0-4914-865d-4faa564f1aef",
85
  "question": "What is the final numeric output from the attached Python code?",
86
+ "submitted_answer": "0",
87
  "ground_truth": "0",
88
+ "correct": true
89
  },
90
  {
91
  "task_id": "3f57289b-8c60-48be-bd80-01f8099ca449",
 
139
  {
140
  "task_id": "5a0c1adf-205e-4841-a666-7c3ef95def9d",
141
  "question": "What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?",
142
+ "submitted_answer": "Claus",
143
  "ground_truth": "Claus",
144
+ "correct": true
145
  }
146
  ]
147
  }
run_local.py CHANGED
@@ -1,4 +1,8 @@
1
  import os
 
 
 
 
2
  import requests
3
  import pandas as pd
4
  import pyarrow.parquet as pq
@@ -45,8 +49,9 @@ def extract_answer(content) -> str:
45
  def normalize_answer(s: str) -> str:
46
  s = s.strip().lower()
47
  s = re.sub(r'^[\$€£¥]+', '', s)
48
- s = re.sub(r'[.,!?;:]+$', '', s)
49
  s = s.replace(',', ' ')
 
50
  s = re.sub(r'\s+', ' ', s)
51
  s = re.sub(r'^(a |an |the )', '', s)
52
  s = s.rstrip('*')
 
1
  import os
2
+ import sys
3
+ import io
4
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
5
+
6
  import requests
7
  import pandas as pd
8
  import pyarrow.parquet as pq
 
49
  def normalize_answer(s: str) -> str:
50
  s = s.strip().lower()
51
  s = re.sub(r'^[\$€£¥]+', '', s)
52
+ s = re.sub(r'\.+$', '', s)
53
  s = s.replace(',', ' ')
54
+ s = re.sub(r'(?<=\d)\s+(?=\d)', '', s)
55
  s = re.sub(r'\s+', ' ', s)
56
  s = re.sub(r'^(a |an |the )', '', s)
57
  s = s.rstrip('*')