aynot commited on
Commit
27ce6f7
·
1 Parent(s): f10b27c

naive cooldown

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -97,20 +97,25 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
97
  "Content-Length": response.headers['Content-Length'],
98
  "content": response.content}
99
 
100
- cooldown_attempts = 2
101
- while cooldown_attempts > 0:
102
- try:
103
- submitted_answer = agent(question_text, additional_data=additional_data)
104
- break
105
- except RateLimitError as e:
106
- print(f"cooldown due to {e}")
107
- sleep(61)
108
- cooldown_attempts -= 1
109
- if cooldown_attempts == 0:
110
- raise e
 
 
111
 
112
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
113
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
 
 
 
114
  except Exception as e:
115
  print(f"Error running agent on task {task_id}: {e}")
116
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
 
97
  "Content-Length": response.headers['Content-Length'],
98
  "content": response.content}
99
 
100
+ submitted_answer = agent(question_text, additional_data=additional_data)
101
+
102
+ # cooldown_attempts = 2
103
+ # while cooldown_attempts > 0:
104
+ # try:
105
+ # submitted_answer = agent(question_text, additional_data=additional_data)
106
+ # break
107
+ # except RateLimitError as e:
108
+ # print(f"cooldown due to {e}")
109
+ # sleep(61)
110
+ # cooldown_attempts -= 1
111
+ # if cooldown_attempts == 0:
112
+ # raise e
113
 
114
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
115
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
116
+
117
+ # cooldown
118
+ sleep(60)
119
  except Exception as e:
120
  print(f"Error running agent on task {task_id}: {e}")
121
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})