lethaq commited on
Commit
aff7c2b
·
verified ·
1 Parent(s): e58672b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -285,15 +285,13 @@ def run_and_submit_all():
285
  print("Agent did not produce any answers to submit.")
286
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
287
 
288
- # 4. Submit answers directly as a dictionary with answers list
289
- print(f"Submitting {len(answers_payload)} answers to: {submit_url}")
290
- try:
291
  # Important: Submit the answers_payload as a dictionary with answers key
292
- submission_dict = {"answers": answers_payload}
293
- response = requests.post(submit_url, json=submission_dict, timeout=60)
294
- response.raise_for_status()
295
- # ...其余代码...
296
-
297
  result_data = response.json()
298
  final_status = (
299
  f"Submission Successful!\n"
@@ -366,7 +364,7 @@ with gr.Blocks() as demo:
366
  if not api_key:
367
  return "Error: GEMINI_API_KEY environment variable not found"
368
 
369
- model = LiteLLMModel(model_id="gemini/gemini-2.0-flash-lite", api_key=AIzaSyAhmwogxZFBtt7_OUsKQGNeOYF7ced39bM)
370
  agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
371
  answer = agent(question)
372
  return answer
 
285
  print("Agent did not produce any answers to submit.")
286
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
287
 
288
+ # 4. Submit answers as a dictionary with answers list
289
+ print(f"Submitting {len(answers_payload)} answers to: {submit_url}")
290
+ try:
291
  # Important: Submit the answers_payload as a dictionary with answers key
292
+ submission_dict = {"answers": answers_payload}
293
+ response = requests.post(submit_url, json=submission_dict, timeout=60)
294
+ response.raise_for_status()
 
 
295
  result_data = response.json()
296
  final_status = (
297
  f"Submission Successful!\n"
 
364
  if not api_key:
365
  return "Error: GEMINI_API_KEY environment variable not found"
366
 
367
+ model = LiteLLMModel(model_id="gemini/gemini-2.0-flash-lite", api_key=api_key)
368
  agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
369
  answer = agent(question)
370
  return answer