MickyWin22 commited on
Commit
b585e91
·
verified ·
1 Parent(s): 95c9871

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -3,6 +3,7 @@ import gradio as gr
3
  import requests
4
  import pandas as pd
5
  import traceback
 
6
 
7
  # Import smol-agent and tool components
8
  from smolagents import CodeAgent, LiteLLMModel, tool
@@ -164,6 +165,10 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
164
  print(f"Error running agent on task {task_id}: {e}")
165
  print(traceback.format_exc())
166
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": error_message})
 
 
 
 
167
 
168
  if not answers_payload:
169
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
 
3
  import requests
4
  import pandas as pd
5
  import traceback
6
+ import time
7
 
8
  # Import smol-agent and tool components
9
  from smolagents import CodeAgent, LiteLLMModel, tool
 
165
  print(f"Error running agent on task {task_id}: {e}")
166
  print(traceback.format_exc())
167
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": error_message})
168
+
169
+ # Add a delay to avoid hitting the API rate limit.
170
+ print("Pausing for 3 seconds to respect API rate limits...")
171
+ time.sleep(3)
172
 
173
  if not answers_payload:
174
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)