Spaces:
Running
Running
set ip limit to 50
Browse files
app.py
CHANGED
@@ -279,7 +279,7 @@ class ClientGenerationManager:
|
|
279 |
self.request_timestamps.append(time.time())
|
280 |
|
281 |
def has_exceeded_limit(self,
|
282 |
-
limit=
|
283 |
with self.lock:
|
284 |
current_time = time.time()
|
285 |
# Filter timestamps to only include those within the last hour
|
@@ -538,8 +538,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
538 |
print(f"Client IP: {client_ip}")
|
539 |
client_generation_manager = ClientManager.get_manager(client_ip)
|
540 |
client_generation_manager.update_activity()
|
541 |
-
if client_generation_manager.has_exceeded_limit(limit=
|
542 |
-
error_message = "❌ Your network has exceeded the limit of
|
543 |
yield (
|
544 |
error_message,
|
545 |
error_message,
|
|
|
279 |
self.request_timestamps.append(time.time())
|
280 |
|
281 |
def has_exceeded_limit(self,
|
282 |
+
limit=50): # Default limit: 50 requests per hour
|
283 |
with self.lock:
|
284 |
current_time = time.time()
|
285 |
# Filter timestamps to only include those within the last hour
|
|
|
538 |
print(f"Client IP: {client_ip}")
|
539 |
client_generation_manager = ClientManager.get_manager(client_ip)
|
540 |
client_generation_manager.update_activity()
|
541 |
+
if client_generation_manager.has_exceeded_limit(limit=50):
|
542 |
+
error_message = "❌ Your network has exceeded the limit of 50 requests per hour. Please try again later."
|
543 |
yield (
|
544 |
error_message,
|
545 |
error_message,
|