Spaces:
Sleeping
Sleeping
Ratelimit management
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
import inspect
|
|
@@ -93,7 +94,18 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 93 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 94 |
continue
|
| 95 |
try:
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 98 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 99 |
except Exception as e:
|
|
|
|
| 1 |
import os
|
| 2 |
+
import time
|
| 3 |
import gradio as gr
|
| 4 |
import requests
|
| 5 |
import inspect
|
|
|
|
| 94 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 95 |
continue
|
| 96 |
try:
|
| 97 |
+
retry_needed = True
|
| 98 |
+
num_try = 0
|
| 99 |
+
while retry_needed and num_try < 10:
|
| 100 |
+
try:
|
| 101 |
+
submitted_answer = agent(question_text)
|
| 102 |
+
retry_needed = False
|
| 103 |
+
except:
|
| 104 |
+
num_try += 1
|
| 105 |
+
print("Retrying ...")
|
| 106 |
+
time.sleep(30)
|
| 107 |
+
|
| 108 |
+
|
| 109 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 110 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 111 |
except Exception as e:
|