Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ def ts_to_str(timestamp, timezone):
|
|
| 17 |
|
| 18 |
def predict(text, request: gr.Request):
|
| 19 |
# Get the IP address from the request object
|
| 20 |
-
ip_address = request.client.host
|
| 21 |
|
| 22 |
# Call the WorldTimeAPI to get the timezone for the user's IP address
|
| 23 |
response = requests.get(f'https://worldtimeapi.org/api/ip/{ip_address}')
|
|
|
|
| 17 |
|
| 18 |
def predict(text, request: gr.Request):
|
| 19 |
# Get the IP address from the request object
|
| 20 |
+
ip_address = request.headers.get('x-forwarded-for', request.client.host)
|
| 21 |
|
| 22 |
# Call the WorldTimeAPI to get the timezone for the user's IP address
|
| 23 |
response = requests.get(f'https://worldtimeapi.org/api/ip/{ip_address}')
|