Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ from token_bucket import Limiter, MemoryStorage
|
|
20 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
21 |
|
22 |
# Rate limiting configuration
|
23 |
-
MAX_MODEL_CALLS_PER_MINUTE =
|
24 |
RATE_LIMIT = MAX_MODEL_CALLS_PER_MINUTE
|
25 |
TOKEN_BUCKET_CAPACITY = RATE_LIMIT
|
26 |
TOKEN_BUCKET_REFILL_RATE = RATE_LIMIT / 60.0 # Tokens per second
|
@@ -167,7 +167,7 @@ async def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
167 |
# Only add if we got a result
|
168 |
if result:
|
169 |
answers_payload.append(result)
|
170 |
-
|
171 |
|
172 |
if not answers_payload:
|
173 |
print("Agent did not produce any answers to submit.")
|
|
|
20 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
21 |
|
22 |
# Rate limiting configuration
|
23 |
+
MAX_MODEL_CALLS_PER_MINUTE = 14 # Conservative buffer below 15 RPM
|
24 |
RATE_LIMIT = MAX_MODEL_CALLS_PER_MINUTE
|
25 |
TOKEN_BUCKET_CAPACITY = RATE_LIMIT
|
26 |
TOKEN_BUCKET_REFILL_RATE = RATE_LIMIT / 60.0 # Tokens per second
|
|
|
167 |
# Only add if we got a result
|
168 |
if result:
|
169 |
answers_payload.append(result)
|
170 |
+
await asyncio.sleep(30)
|
171 |
|
172 |
if not answers_payload:
|
173 |
print("Agent did not produce any answers to submit.")
|