Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,9 +23,14 @@ def check_rate_limit(request: gr.Request):
|
|
23 |
ip = request.client.host
|
24 |
now = time.time()
|
25 |
|
|
|
|
|
|
|
26 |
# Clean up old timestamps outside the time window
|
27 |
request_times[ip] = [t for t in request_times[ip] if now - t < TIME_WINDOW]
|
28 |
|
|
|
|
|
29 |
# Check if rate limit exceeded
|
30 |
if len(request_times[ip]) >= MAX_REQUESTS:
|
31 |
time_remaining = int(TIME_WINDOW - (now - request_times[ip][0]))
|
|
|
23 |
ip = request.client.host
|
24 |
now = time.time()
|
25 |
|
26 |
+
print(f"Ip: {ip}")
|
27 |
+
print(f"Now: {now}")
|
28 |
+
print(f"Request times: {request_times[ip]}")
|
29 |
# Clean up old timestamps outside the time window
|
30 |
request_times[ip] = [t for t in request_times[ip] if now - t < TIME_WINDOW]
|
31 |
|
32 |
+
print(f"Request times: {request_times[ip]}")
|
33 |
+
|
34 |
# Check if rate limit exceeded
|
35 |
if len(request_times[ip]) >= MAX_REQUESTS:
|
36 |
time_remaining = int(TIME_WINDOW - (now - request_times[ip][0]))
|