Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,6 +21,7 @@ MAX_MODEL_CALLS_PER_MINUTE = 14 # Conservative buffer below 15 RPM
|
|
| 21 |
TOKEN_BUCKET_CAPACITY = MAX_MODEL_CALLS_PER_MINUTE
|
| 22 |
TOKEN_BUCKET_REFILL_RATE = MAX_MODEL_CALLS_PER_MINUTE / 60.0 # Tokens per second
|
| 23 |
|
|
|
|
| 24 |
# Initialize global token bucket with MemoryStorage
|
| 25 |
storage = MemoryStorage()
|
| 26 |
token_bucket = Limiter(rate=TOKEN_BUCKET_REFILL_RATE, capacity=TOKEN_BUCKET_CAPACITY, storage=storage)
|
|
@@ -71,8 +72,7 @@ async def determine_extension(content_type: str, content: bytes, question
|
|
| 71 |
# Standard MIME type checks
|
| 72 |
if "image/png" in content_type:
|
| 73 |
return ".png"
|
| 74 |
-
elif
|
| 75 |
-
"jpeg" in content_type or "jpg" in content_type:
|
| 76 |
return ".jpg"
|
| 77 |
elif "spreadsheetml.sheet" in content_type:
|
| 78 |
return ".xlsx"
|
|
|
|
| 21 |
TOKEN_BUCKET_CAPACITY = MAX_MODEL_CALLS_PER_MINUTE
|
| 22 |
TOKEN_BUCKET_REFILL_RATE = MAX_MODEL_CALLS_PER_MINUTE / 60.0 # Tokens per second
|
| 23 |
|
| 24 |
+
|
| 25 |
# Initialize global token bucket with MemoryStorage
|
| 26 |
storage = MemoryStorage()
|
| 27 |
token_bucket = Limiter(rate=TOKEN_BUCKET_REFILL_RATE, capacity=TOKEN_BUCKET_CAPACITY, storage=storage)
|
|
|
|
| 72 |
# Standard MIME type checks
|
| 73 |
if "image/png" in content_type:
|
| 74 |
return ".png"
|
| 75 |
+
elif "jpeg" in content_type or "jpg" in content_type:
|
|
|
|
| 76 |
return ".jpg"
|
| 77 |
elif "spreadsheetml.sheet" in content_type:
|
| 78 |
return ".xlsx"
|