Update app.py
Browse files
app.py
CHANGED
@@ -7,11 +7,10 @@ def predict(text, request: gr.Request):
|
|
7 |
headers = request.kwargs['headers']
|
8 |
if headers and 'x-forwarded-for' in headers:
|
9 |
x_forwarded_for = headers['x-forwarded-for']
|
10 |
-
|
11 |
|
12 |
-
print("
|
13 |
-
return text, {"
|
14 |
-
"client_ip": client_ip,
|
15 |
"local_ip": local_ip,
|
16 |
"headers": headers}
|
17 |
|
|
|
7 |
headers = request.kwargs['headers']
|
8 |
if headers and 'x-forwarded-for' in headers:
|
9 |
x_forwarded_for = headers['x-forwarded-for']
|
10 |
+
client_ip = x_forwarded_for.split(' ')[0] if x_forwarded_for else ""
|
11 |
|
12 |
+
print("client_ip", client_ip, text, "\n\n")
|
13 |
+
return text, {"client_ip": client_ip,
|
|
|
14 |
"local_ip": local_ip,
|
15 |
"headers": headers}
|
16 |
|