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