vmoras commited on
Commit
5c7957c
1 Parent(s): 739f8ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -10,20 +10,15 @@ model = SamModel.from_pretrained('facebook/sam-vit-huge')
10
  processor = SamProcessor.from_pretrained('facebook/sam-vit-huge')
11
 
12
 
13
- def set_predictor(image, request: gr.Request):
14
  """
15
  Creates a Sam predictor object based on a given image and model.
16
  """
17
- if request:
18
- result = str(request.headers) + "|" + str(request.query_params) + "|" + str(request.path_params) + "|" + str(request.url)
19
- else:
20
- result = 'done'
21
-
22
  device = 'cpu'
23
  inputs = processor(image, return_tensors='pt').to(device)
24
  image_embedding = model.get_image_embeddings(inputs['pixel_values'])
25
 
26
- return [image, image_embedding, result]
27
 
28
 
29
  def get_polygon(points, image, image_embedding):
 
10
  processor = SamProcessor.from_pretrained('facebook/sam-vit-huge')
11
 
12
 
13
+ 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):