innafomina commited on
Commit
87d8826
·
1 Parent(s): e6d27da

fixed indentation issue

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -103,6 +103,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
103
  # model = OpenAIServerModel(model_id="gpt-4o",
104
  # api_key=os.getenv("OPEN_AI_KEY"))
105
  agent = BasicAgent(model=model)
 
106
  except Exception as e:
107
  print(f"Error instantiating agent: {e}")
108
  return f"Error initializing agent: {e}", None
@@ -110,8 +111,6 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
110
  agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
111
  print(agent_code)
112
 
113
- # 2. Fetch Questions
114
-
115
  # 3. Run your Agent
116
  results_log = []
117
  answers_payload = []
@@ -142,9 +141,9 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
142
  print(f"Error running agent on task {task_id}: {e}")
143
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
144
 
145
- if not answers_payload:
146
- print("Agent did not produce any answers to submit.")
147
- return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
148
 
149
  #4. Prepare Submission
150
  submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
 
103
  # model = OpenAIServerModel(model_id="gpt-4o",
104
  # api_key=os.getenv("OPEN_AI_KEY"))
105
  agent = BasicAgent(model=model)
106
+ print('Initialized the agent.')
107
  except Exception as e:
108
  print(f"Error instantiating agent: {e}")
109
  return f"Error initializing agent: {e}", None
 
111
  agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
112
  print(agent_code)
113
 
 
 
114
  # 3. Run your Agent
115
  results_log = []
116
  answers_payload = []
 
141
  print(f"Error running agent on task {task_id}: {e}")
142
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
143
 
144
+ if not answers_payload:
145
+ print("Agent did not produce any answers to submit.")
146
+ return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
147
 
148
  #4. Prepare Submission
149
  submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}