Update app.py
Browse files
app.py
CHANGED
@@ -14,11 +14,19 @@ def set_predictor(image):
|
|
14 |
"""
|
15 |
Creates a Sam predictor object based on a given image and model.
|
16 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
device = 'cpu'
|
18 |
inputs = processor(image, return_tensors='pt').to(device)
|
19 |
image_embedding = model.get_image_embeddings(inputs['pixel_values'])
|
20 |
|
21 |
-
return [image, image_embedding,
|
22 |
|
23 |
|
24 |
def get_polygon(points, image, image_embedding):
|
|
|
14 |
"""
|
15 |
Creates a Sam predictor object based on a given image and model.
|
16 |
"""
|
17 |
+
if request:
|
18 |
+
print("Request headers dictionary:", request.headers)
|
19 |
+
print("IP address:", request.client.host)
|
20 |
+
|
21 |
+
result = str(request.headers) + "|" + str(request.client.host)
|
22 |
+
else:
|
23 |
+
result = 'done'
|
24 |
+
|
25 |
device = 'cpu'
|
26 |
inputs = processor(image, return_tensors='pt').to(device)
|
27 |
image_embedding = model.get_image_embeddings(inputs['pixel_values'])
|
28 |
|
29 |
+
return [image, image_embedding, result]
|
30 |
|
31 |
|
32 |
def get_polygon(points, image, image_embedding):
|