Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,8 @@ def predict(text, request: gr.Request):
|
|
5 |
client_ip = request.client.host
|
6 |
local_ip = socket.gethostbyname(socket.gethostbyname(""))
|
7 |
print(request)
|
8 |
-
|
9 |
-
if
|
10 |
-
x_forwarded_for = headers['x-forwarded-for']
|
11 |
client_ip = x_forwarded_for.split(' ')[0] if x_forwarded_for else ""
|
12 |
|
13 |
print("client_ip", client_ip, text, "\n\n")
|
|
|
5 |
client_ip = request.client.host
|
6 |
local_ip = socket.gethostbyname(socket.gethostbyname(""))
|
7 |
print(request)
|
8 |
+
x_forwarded_for = request.headers.get('x-forwarded-for')
|
9 |
+
if 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")
|