MCPcopy Create free account
hub / github.com/MrSyee/SAM-remove-background / postprocess

Method postprocess

src/server/tasks/sam.py:98–105  ·  view source on GitHub ↗

Postprocess the inference results for exporting as API response.

(self, image_embedding: torch.Tensor)

Source from the content-addressed store, hash-verified

96 return preprocessed
97
98 def postprocess(self, image_embedding: torch.Tensor) -> Dict[str, Any]:
99 """Postprocess the inference results for exporting as API response."""
100 image_embedding_shape = image_embedding.shape
101 image_embedding = base64.b64encode(image_embedding.tobytes()).decode("utf8")
102 return {
103 "image_embedding": image_embedding,
104 "image_embedding_shape": image_embedding_shape,
105 }
106
107 @staticmethod
108 def get_preprocess_shape(

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected