Update app.py
Browse files
app.py
CHANGED
@@ -10,12 +10,56 @@ from smolagents import Tool
|
|
10 |
from smolagents import PythonInterpreterTool
|
11 |
from smolagents import DuckDuckGoSearchTool
|
12 |
|
|
|
|
|
13 |
# (Keep Constants as is)
|
14 |
# --- Constants ---
|
15 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
16 |
|
17 |
# --- Basic Agent Definition ---
|
18 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
class BasicAgent:
|
20 |
def __init__(self):
|
21 |
print("Starting the initialization of model.")
|
@@ -62,6 +106,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
62 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
63 |
and displays the results.
|
64 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
# --- Determine HF Space Runtime URL and Repo URL ---
|
66 |
space_id = os.getenv("SPACE_ID") # Get the SPACE_ID for sending link to the code
|
67 |
|
|
|
10 |
from smolagents import PythonInterpreterTool
|
11 |
from smolagents import DuckDuckGoSearchTool
|
12 |
|
13 |
+
from huggingface_hub import hf_hub_download
|
14 |
+
|
15 |
# (Keep Constants as is)
|
16 |
# --- Constants ---
|
17 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
18 |
|
19 |
# --- Basic Agent Definition ---
|
20 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
21 |
+
|
22 |
+
# GAIA Dataset file dowloading
|
23 |
+
"""
|
24 |
+
Basic function to download a GAIA dataset validation file
|
25 |
+
"""
|
26 |
+
def get_GAIA_dataset_validation_file(file_name: str):
|
27 |
+
|
28 |
+
response = hf_hub_download(
|
29 |
+
repo_id="gaia-benchmark/GAIA",
|
30 |
+
filename= f"2023/validation/{file_name}",
|
31 |
+
repo_type="dataset"
|
32 |
+
)
|
33 |
+
|
34 |
+
return response
|
35 |
+
|
36 |
+
"""
|
37 |
+
Basic function to download a GAIA dataset test file
|
38 |
+
"""
|
39 |
+
def get_GAIA_dataset_test_file(file_name: str):
|
40 |
+
|
41 |
+
response = hf_hub_download(
|
42 |
+
repo_id="gaia-benchmark/GAIA",
|
43 |
+
filename= f"2023/test/{file_name}",
|
44 |
+
repo_type="dataset"
|
45 |
+
)
|
46 |
+
|
47 |
+
return response
|
48 |
+
|
49 |
+
"""
|
50 |
+
Basic function to download a GAIA dataset file (validation attempted first)
|
51 |
+
"""
|
52 |
+
def get_GAIA_dataset_file(file_name: str):
|
53 |
+
response = None
|
54 |
+
try:
|
55 |
+
response = get_GAIA_dataset_validation_file(file_name)
|
56 |
+
except:
|
57 |
+
response = get_GAIA_dataset_test_file(file_name)
|
58 |
+
|
59 |
+
return response
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
class BasicAgent:
|
64 |
def __init__(self):
|
65 |
print("Starting the initialization of model.")
|
|
|
106 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
107 |
and displays the results.
|
108 |
"""
|
109 |
+
print("!!!!!!!!!!!!! HANDLING DATASET FILE")
|
110 |
+
response = get_GAIA_dataset_file("076c8171-9b3b-49b9-a477-244d2a532826.xlsx")
|
111 |
+
print(response)
|
112 |
+
|
113 |
+
return
|
114 |
+
|
115 |
# --- Determine HF Space Runtime URL and Repo URL ---
|
116 |
space_id = os.getenv("SPACE_ID") # Get the SPACE_ID for sending link to the code
|
117 |
|