Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,9 @@ class BasicAgent:
|
|
| 46 |
#return asyncio.run(self.run(question))
|
| 47 |
return self.run(question)
|
| 48 |
#return self.agent.run(question)
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
| 51 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 52 |
"""
|
|
@@ -69,7 +71,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 69 |
|
| 70 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 71 |
try:
|
| 72 |
-
agent = BasicAgent()
|
| 73 |
except Exception as e:
|
| 74 |
print(f"Error instantiating agent: {e}")
|
| 75 |
return f"Error initializing agent: {e}", None
|
|
@@ -121,7 +123,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 121 |
# return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
| 122 |
|
| 123 |
#3A
|
| 124 |
-
async def run_all_questions(
|
| 125 |
answers_payload = []
|
| 126 |
for item in questions_data:
|
| 127 |
task_id = item.get("task_id")
|
|
@@ -138,7 +140,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 138 |
print(f"Error on Task {task_id}: {e}")
|
| 139 |
return answers_payload
|
| 140 |
|
| 141 |
-
answers_payload = asyncio.run(run_all_questions(
|
| 142 |
|
| 143 |
#3B
|
| 144 |
|
|
|
|
| 46 |
#return asyncio.run(self.run(question))
|
| 47 |
return self.run(question)
|
| 48 |
#return self.agent.run(question)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
agent = BasicAgent()
|
| 52 |
|
| 53 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 54 |
"""
|
|
|
|
| 71 |
|
| 72 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 73 |
try:
|
| 74 |
+
#agent = BasicAgent()
|
| 75 |
except Exception as e:
|
| 76 |
print(f"Error instantiating agent: {e}")
|
| 77 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 123 |
# return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
| 124 |
|
| 125 |
#3A
|
| 126 |
+
async def run_all_questions(questions_data):
|
| 127 |
answers_payload = []
|
| 128 |
for item in questions_data:
|
| 129 |
task_id = item.get("task_id")
|
|
|
|
| 140 |
print(f"Error on Task {task_id}: {e}")
|
| 141 |
return answers_payload
|
| 142 |
|
| 143 |
+
answers_payload = asyncio.run(run_all_questions(questions_data))
|
| 144 |
|
| 145 |
#3B
|
| 146 |
|