コード例 #1
0
 def serving_method(self, images: list, **kwargs):
     """
     Run as a service.
     """
     images_decode = [base64_to_cv2(image) for image in images[0]]
     style_decode = base64_to_cv2(images[1])
     results = self.predict(origin=images_decode, style=style_decode, **kwargs)
     final={}
     final['data'] = [cv2_to_base64(result) for result in results]
     return final
コード例 #2
0
 def serving_method(self, images: List[str], **kwargs):
     """
     Run as a service.
     """
     images_decode = [base64_to_cv2(image) for image in images]
     visual = self.predict(images=images_decode, **kwargs)
     final = []
     for mask in visual:
         final.append(cv2_to_base64(mask))
     return final
コード例 #3
0
 def serving_method(self, images: list, **kwargs):
     """
     Run as a service.
     """
     images_decode = [base64_to_cv2(image) for image in images]
     visual = self.predict(images=images_decode, **kwargs)
     final={}
     for i, visual_ret in enumerate(visual):
         h, w, c = images_decode[i].shape
         for key, value in visual_ret.items():
             value = cv2.resize(cv2.cvtColor(value,cv2.COLOR_RGB2BGR), (w, h), cv2.INTER_NEAREST)
             visual_ret[key] = cv2_to_base64(value)
     final['data'] = visual
     return final