squanchd commited on
Commit
6539990
1 Parent(s): e7ed489
Files changed (1) hide show
  1. handler.py +11 -10
handler.py CHANGED
@@ -15,14 +15,15 @@ class EndpointHandler():
15
 
16
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
17
  imageData = data.pop("image", data)
18
- image = Image.open(BytesIO(base64.b64decode(imageData)))
19
- face_batch = self.mtcnn([image])
20
- face_batch = [i for i in face_batch if i is not None]
21
- if face_batch:
22
- aligned = torch.stack(face_batch)
23
- if self.device.type == "cuda":
24
- aligned = aligned.to(self.device)
 
25
 
26
- embeddings = self.resnet(aligned).detach().cpu()
27
- return embeddings.tolist()
28
- else: return None
 
15
 
16
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
17
  imageData = data.pop("image", data)
18
+ return imageData
19
+ # image = Image.open(BytesIO(base64.b64decode(imageData)))
20
+ # face_batch = self.mtcnn([image])
21
+ # face_batch = [i for i in face_batch if i is not None]
22
+ # if face_batch:
23
+ # aligned = torch.stack(face_batch)
24
+ # if self.device.type == "cuda":
25
+ # aligned = aligned.to(self.device)
26
 
27
+ # embeddings = self.resnet(aligned).detach().cpu()
28
+ # return embeddings.tolist()
29
+ # else: return None