chengzeyi commited on
Commit
337b650
·
1 Parent(s): d81f080

set ip limit to 50

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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=100): # Default limit: 100 requests per hour
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=100):
542
- error_message = "❌ Your network has exceeded the limit of 100 requests per hour. Please try again later."
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,