Update run.py
Browse files
run.py
CHANGED
|
@@ -80,12 +80,20 @@ collection = client.get_collection(name="chromaTS", embedding_function=sentence_
|
|
| 80 |
|
| 81 |
inference_client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 82 |
|
| 83 |
-
def extract_ip_and_device(
|
| 84 |
ip_address = None
|
| 85 |
device_info = None
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
| 87 |
for header in headers:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
key, value = header
|
|
|
|
| 89 |
if key == b'x-forwarded-for':
|
| 90 |
ip_address = value.decode('utf-8')
|
| 91 |
elif key == b'user-agent':
|
|
|
|
| 80 |
|
| 81 |
inference_client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 82 |
|
| 83 |
+
def extract_ip_and_device(headers_obj):
|
| 84 |
ip_address = None
|
| 85 |
device_info = None
|
| 86 |
+
|
| 87 |
+
# Access the raw headers list
|
| 88 |
+
headers = headers_obj.raw
|
| 89 |
+
|
| 90 |
for header in headers:
|
| 91 |
+
if len(header) != 2:
|
| 92 |
+
print(f"Unexpected header format: {header}")
|
| 93 |
+
continue
|
| 94 |
+
|
| 95 |
key, value = header
|
| 96 |
+
|
| 97 |
if key == b'x-forwarded-for':
|
| 98 |
ip_address = value.decode('utf-8')
|
| 99 |
elif key == b'user-agent':
|