Spaces:
Paused
Paused
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -5,15 +5,31 @@ from docx import Document
|
|
| 5 |
from huggingface_hub import login
|
| 6 |
from pptx import Presentation
|
| 7 |
|
| 8 |
-
def get_questions(
|
| 9 |
-
#df = pd.read_json(file_path, lines=True)
|
| 10 |
-
|
| 11 |
-
###
|
| 12 |
token = os.getenv("HF_TOKEN")
|
|
|
|
| 13 |
login(token)
|
|
|
|
| 14 |
dataset = load_dataset("gaia-benchmark/GAIA", "2023_all", split="validation", trust_remote_code=True)
|
|
|
|
| 15 |
df = pd.DataFrame(dataset)
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
if level > 0:
|
| 19 |
df = df[df["Level"] == level]
|
|
|
|
| 5 |
from huggingface_hub import login
|
| 6 |
from pptx import Presentation
|
| 7 |
|
| 8 |
+
def get_questions():
|
|
|
|
|
|
|
|
|
|
| 9 |
token = os.getenv("HF_TOKEN")
|
| 10 |
+
|
| 11 |
login(token)
|
| 12 |
+
|
| 13 |
dataset = load_dataset("gaia-benchmark/GAIA", "2023_all", split="validation", trust_remote_code=True)
|
| 14 |
+
|
| 15 |
df = pd.DataFrame(dataset)
|
| 16 |
+
|
| 17 |
+
result_1=[]
|
| 18 |
+
result_2=[]
|
| 19 |
+
result_3=[]
|
| 20 |
+
|
| 21 |
+
for index, row in df.iterrows():
|
| 22 |
+
if df["Level"] == 1:
|
| 23 |
+
result_1.append([row["Question"], row["Level"], row["Final answer"], row["file_name"]])
|
| 24 |
+
if df["Level"] == 2:
|
| 25 |
+
result_2.append([row["Question"], row["Level"], row["Final answer"], row["file_name"]])
|
| 26 |
+
if df["Level"] == 3:
|
| 27 |
+
result_3.append([row["Question"], row["Level"], row["Final answer"], row["file_name"]])
|
| 28 |
+
|
| 29 |
+
return result_1, result_2, result_3
|
| 30 |
+
|
| 31 |
+
def get_questions(file_path, level):
|
| 32 |
+
df = pd.read_json(file_path, lines=True)
|
| 33 |
|
| 34 |
if level > 0:
|
| 35 |
df = df[df["Level"] == level]
|