Synnove commited on
Commit
82fec12
·
verified ·
1 Parent(s): 335a818

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -38
app.py CHANGED
@@ -69,46 +69,46 @@ agent_codeagent = CodeAgent(
69
  )
70
 
71
 
72
- #def run_and_submit_one():
73
- # 1. Instantiate Agent ( modify this part to create your agent)
74
- try:
75
- #agent = BasicAgent()
76
- agent = agent_codeagent
77
 
78
- except Exception as e:
79
- print(f"Error instantiating agent: {e}")
80
- return f"Error initializing agent: {e}", None
81
 
82
- # 2. Fetch Questions by loading from local json
83
- status_message, questions_data = load_questions_from_file()
84
-
85
- if questions_data is not None and len(questions_data) > 0:
86
- first_question = questions_data[0]
87
- print("First question object:", first_question)
88
-
89
- #To test
90
- question_text = first_question.get("question")
91
- task_id = first_question.get("task_id")
92
- print(f"\nTask ID: {task_id}")
93
- print(f"Question: {question_text}")
94
- else:
95
- print("No data found.")
96
-
97
- # 3. Run your Agent
98
- results_log = []
99
- answers_payload = []
100
-
101
- try:
102
- submitted_answer = agent(question_text)
103
- answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
104
- results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
105
- except Exception as e:
106
- print(f"Error running agent on task {task_id}: {e}")
107
- results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
108
-
109
- if not answers_payload:
110
- print("Agent did not produce any answers to submit.")
111
- return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
112
 
113
  #run_and_submit_one()
114
 
 
69
  )
70
 
71
 
72
+ # #def run_and_submit_one():
73
+ # # 1. Instantiate Agent ( modify this part to create your agent)
74
+ # try:
75
+ # #agent = BasicAgent()
76
+ # agent = agent_codeagent
77
 
78
+ # except Exception as e:
79
+ # print(f"Error instantiating agent: {e}")
80
+ # return f"Error initializing agent: {e}", None
81
 
82
+ # # 2. Fetch Questions by loading from local json
83
+ # status_message, questions_data = load_questions_from_file()
84
+
85
+ # if questions_data is not None and len(questions_data) > 0:
86
+ # first_question = questions_data[0]
87
+ # print("First question object:", first_question)
88
+
89
+ # #To test
90
+ # question_text = first_question.get("question")
91
+ # task_id = first_question.get("task_id")
92
+ # print(f"\nTask ID: {task_id}")
93
+ # print(f"Question: {question_text}")
94
+ # else:
95
+ # print("No data found.")
96
+
97
+ # # 3. Run your Agent
98
+ # results_log = []
99
+ # answers_payload = []
100
+
101
+ # try:
102
+ # submitted_answer = agent(question_text)
103
+ # answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
104
+ # results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
105
+ # except Exception as e:
106
+ # print(f"Error running agent on task {task_id}: {e}")
107
+ # results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
108
+
109
+ # if not answers_payload:
110
+ # print("Agent did not produce any answers to submit.")
111
+ # return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
112
 
113
  #run_and_submit_one()
114