vmoras commited on
Commit
9220bc3
·
1 Parent(s): e1ecd24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
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, 'Done']
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):