Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ from token_bucket import Limiter, MemoryStorage
|
|
| 23 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 24 |
|
| 25 |
# Rate limiting configuration
|
| 26 |
-
MAX_MODEL_CALLS_PER_MINUTE =
|
| 27 |
RATE_LIMIT = MAX_MODEL_CALLS_PER_MINUTE
|
| 28 |
TOKEN_BUCKET_CAPACITY = RATE_LIMIT
|
| 29 |
TOKEN_BUCKET_REFILL_RATE = RATE_LIMIT / 60.0 # Tokens per second
|
|
@@ -73,7 +73,7 @@ async def process_question(agent, question_text: str, task_id: str, results_log:
|
|
| 73 |
"""Process a single question with global rate limiting."""
|
| 74 |
submitted_answer = None
|
| 75 |
max_retries = 3
|
| 76 |
-
retry_delay =
|
| 77 |
|
| 78 |
for attempt in range(max_retries):
|
| 79 |
try:
|
|
|
|
| 23 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 24 |
|
| 25 |
# Rate limiting configuration
|
| 26 |
+
MAX_MODEL_CALLS_PER_MINUTE = 10 # Conservative buffer below 15 RPM
|
| 27 |
RATE_LIMIT = MAX_MODEL_CALLS_PER_MINUTE
|
| 28 |
TOKEN_BUCKET_CAPACITY = RATE_LIMIT
|
| 29 |
TOKEN_BUCKET_REFILL_RATE = RATE_LIMIT / 60.0 # Tokens per second
|
|
|
|
| 73 |
"""Process a single question with global rate limiting."""
|
| 74 |
submitted_answer = None
|
| 75 |
max_retries = 3
|
| 76 |
+
retry_delay = 60 # Start with Gemini's recommended delay
|
| 77 |
|
| 78 |
for attempt in range(max_retries):
|
| 79 |
try:
|