Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,17 +48,20 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
48 |
# 2. Fetch Questions
|
49 |
print(f"Fetching questions from: {questions_url}")
|
50 |
try:
|
51 |
-
response = requests.get(questions_url, timeout=
|
52 |
response.raise_for_status()
|
53 |
questions_data = response.json()
|
54 |
if not questions_data:
|
55 |
print("Fetched questions list is empty.")
|
56 |
return "Fetched questions list is empty or invalid format.", None
|
57 |
print(f"Fetched {len(questions_data)} questions.")
|
|
|
|
|
58 |
except requests.exceptions.RequestException as e:
|
59 |
print(f"Error fetching questions: {e}")
|
60 |
return f"Error fetching questions: {e}", None
|
61 |
|
|
|
62 |
# 3. Run Agent
|
63 |
results_log = []
|
64 |
answers_payload = []
|
|
|
48 |
# 2. Fetch Questions
|
49 |
print(f"Fetching questions from: {questions_url}")
|
50 |
try:
|
51 |
+
response = requests.get(questions_url, timeout=20)
|
52 |
response.raise_for_status()
|
53 |
questions_data = response.json()
|
54 |
if not questions_data:
|
55 |
print("Fetched questions list is empty.")
|
56 |
return "Fetched questions list is empty or invalid format.", None
|
57 |
print(f"Fetched {len(questions_data)} questions.")
|
58 |
+
# Añadir un pequeño retraso para evitar el error 429
|
59 |
+
time.sleep(2) # Pausa de 2 segundos antes de la siguiente solicitud
|
60 |
except requests.exceptions.RequestException as e:
|
61 |
print(f"Error fetching questions: {e}")
|
62 |
return f"Error fetching questions: {e}", None
|
63 |
|
64 |
+
|
65 |
# 3. Run Agent
|
66 |
results_log = []
|
67 |
answers_payload = []
|