Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,29 +39,19 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 39 |
print(f"Error instantiating agent: {e}")
|
| 40 |
return f"Error initializing agent: {e}", None
|
| 41 |
# In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
|
| 42 |
-
|
| 43 |
-
print(agent_code)
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
print(f"Error fetching questions: {e}")
|
| 57 |
-
return f"Error fetching questions: {e}", None
|
| 58 |
-
except requests.exceptions.JSONDecodeError as e:
|
| 59 |
-
print(f"Error decoding JSON response from questions endpoint: {e}")
|
| 60 |
-
print(f"Response text: {response.text[:500]}")
|
| 61 |
-
return f"Error decoding server response for questions: {e}", None
|
| 62 |
-
except Exception as e:
|
| 63 |
-
print(f"An unexpected error occurred fetching questions: {e}")
|
| 64 |
-
return f"An unexpected error occurred fetching questions: {e}", None
|
| 65 |
|
| 66 |
# 3. Run your Agent
|
| 67 |
results_log = []
|
|
@@ -192,19 +182,6 @@ if __name__ == "__main__":
|
|
| 192 |
print(space_host_startup)
|
| 193 |
space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
|
| 194 |
print(space_id_startup)
|
| 195 |
-
ACCESS_TOKEN = os.getenv("HF_KEY")
|
| 196 |
-
|
| 197 |
-
if not ACCESS_TOKEN:
|
| 198 |
-
raise ValueError("HF_TOKEN environment variable is not set. Please set it in Space Secrets.")
|
| 199 |
-
data_dir = snapshot_download(
|
| 200 |
-
repo_id="gaia-benchmark/GAIA",
|
| 201 |
-
repo_type="dataset"
|
| 202 |
-
)
|
| 203 |
-
|
| 204 |
-
dataset = load_dataset(data_dir, "2023_level1", split="test")
|
| 205 |
-
print("Dataset", dataset)
|
| 206 |
-
print(len(dataset))
|
| 207 |
-
print(type(dataset))
|
| 208 |
|
| 209 |
if space_host_startup:
|
| 210 |
print(f"✅ SPACE_HOST found: {space_host_startup}")
|
|
|
|
| 39 |
print(f"Error instantiating agent: {e}")
|
| 40 |
return f"Error initializing agent: {e}", None
|
| 41 |
# In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
|
| 42 |
+
ACCESS_TOKEN = os.getenv("HF_KEY")
|
|
|
|
| 43 |
|
| 44 |
+
if not ACCESS_TOKEN:
|
| 45 |
+
raise ValueError("HF_TOKEN environment variable is not set. Please set it in Space Secrets.")
|
| 46 |
+
data_dir = snapshot_download(
|
| 47 |
+
repo_id="gaia-benchmark/GAIA",
|
| 48 |
+
repo_type="dataset"
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
dataset = load_dataset(data_dir, "2023_level1", split="test")
|
| 52 |
+
print("Dataset", dataset)
|
| 53 |
+
print(len(dataset))
|
| 54 |
+
print(type(dataset))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# 3. Run your Agent
|
| 57 |
results_log = []
|
|
|
|
| 182 |
print(space_host_startup)
|
| 183 |
space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
|
| 184 |
print(space_id_startup)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
if space_host_startup:
|
| 187 |
print(f"✅ SPACE_HOST found: {space_host_startup}")
|