add print statement to handler
Browse files- handler.py +5 -4
handler.py
CHANGED
|
@@ -33,10 +33,11 @@ class EndpointHandler:
|
|
| 33 |
|
| 34 |
def __call__(self, data: dict[str, any]) -> dict[str, str]:
|
| 35 |
base64_image = data.get('inputs')
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
| 40 |
output_image = output_image.convert('RGB')
|
| 41 |
output_buffer = io.BytesIO()
|
| 42 |
output_image.save(output_buffer, format="png")
|
|
|
|
| 33 |
|
| 34 |
def __call__(self, data: dict[str, any]) -> dict[str, str]:
|
| 35 |
base64_image = data.get('inputs')
|
| 36 |
+
input_tensor = self._decode_base64_image(base64_image)
|
| 37 |
+
print('Input tensor shape: ' + str(input_tensor.shape))
|
| 38 |
+
output_tensor = self.generator(input_tensor)
|
| 39 |
+
output_tensor = output_tensor.squeeze(0)
|
| 40 |
+
output_image = transforms.ToPILImage()(output_tensor)
|
| 41 |
output_image = output_image.convert('RGB')
|
| 42 |
output_buffer = io.BytesIO()
|
| 43 |
output_image.save(output_buffer, format="png")
|