Spaces:
Runtime error
Runtime error
Make `run_and_submit_all` asynchronous, update imports, and add telemetry initialization
Browse files
src/gaia_solving_agent/app.py
CHANGED
|
@@ -1,15 +1,17 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
from hf_submission_api import (
|
| 5 |
instantiate_agent,
|
| 6 |
fetching_questions,
|
| 7 |
run_agent,
|
| 8 |
prepare_submission_data,
|
| 9 |
submit_answers,
|
| 10 |
)
|
|
|
|
| 11 |
|
| 12 |
-
|
|
|
|
| 13 |
"""
|
| 14 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 15 |
and displays the results.
|
|
@@ -25,13 +27,13 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 25 |
return "Please Login to Hugging Face with the button.", None
|
| 26 |
|
| 27 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 28 |
-
agent, agent_code = instantiate_agent(space_id)
|
| 29 |
|
| 30 |
# 2. Fetch Questions
|
| 31 |
questions_data = fetching_questions()
|
| 32 |
|
| 33 |
# 3. Run your Agent
|
| 34 |
-
answers_payload, results_log = run_agent(agent, questions_data)
|
| 35 |
|
| 36 |
# 4. Prepare submissions
|
| 37 |
submission_data = prepare_submission_data(username, agent_code, answers_payload)
|
|
@@ -95,5 +97,8 @@ if __name__ == "__main__":
|
|
| 95 |
|
| 96 |
print("-"*(60 + len(" App Starting ")) + "\n")
|
| 97 |
|
|
|
|
|
|
|
|
|
|
| 98 |
print("Launching Gradio Interface for Basic Agent Evaluation...")
|
| 99 |
demo.launch(debug=True, share=False)
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
from gaia_solving_agent.hf_submission_api import (
|
| 5 |
instantiate_agent,
|
| 6 |
fetching_questions,
|
| 7 |
run_agent,
|
| 8 |
prepare_submission_data,
|
| 9 |
submit_answers,
|
| 10 |
)
|
| 11 |
+
from gaia_solving_agent.telemetry import set_telemetry
|
| 12 |
|
| 13 |
+
|
| 14 |
+
async def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 15 |
"""
|
| 16 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 17 |
and displays the results.
|
|
|
|
| 27 |
return "Please Login to Hugging Face with the button.", None
|
| 28 |
|
| 29 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 30 |
+
agent, agent_code = instantiate_agent(space_id, timeout=20)
|
| 31 |
|
| 32 |
# 2. Fetch Questions
|
| 33 |
questions_data = fetching_questions()
|
| 34 |
|
| 35 |
# 3. Run your Agent
|
| 36 |
+
answers_payload, results_log = await run_agent(agent, questions_data)
|
| 37 |
|
| 38 |
# 4. Prepare submissions
|
| 39 |
submission_data = prepare_submission_data(username, agent_code, answers_payload)
|
|
|
|
| 97 |
|
| 98 |
print("-"*(60 + len(" App Starting ")) + "\n")
|
| 99 |
|
| 100 |
+
print("start telemetry")
|
| 101 |
+
set_telemetry()
|
| 102 |
+
|
| 103 |
print("Launching Gradio Interface for Basic Agent Evaluation...")
|
| 104 |
demo.launch(debug=True, share=False)
|