2021-03-18 18:09:59,230 [INFO ] W-9000-WasteNet_1.0 org.pytorch.serve.wlm.WorkerThread - Backend response time: 3
2021-03-18 18:09:59,232 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle - Traceback (most recent call last):
2021-03-18 18:09:59,233 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -   File "c:\users\mchintha\anaconda\lib\site-packages\ts\service.py", line 100, in predict
2021-03-18 18:09:59,233 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -     ret = self._entry_point(input_batch, self.context)
2021-03-18 18:09:59,234 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -   File "c:\users\mchintha\anaconda\lib\site-packages\ts\torch_handler\base_handler.py", line 125, in handle
2021-03-18 18:09:59,234 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -     data = self.preprocess(data)
2021-03-18 18:09:59,235 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -   File "c:\users\mchintha\anaconda\lib\site-packages\ts\torch_handler\vision_handler.py", line 21, in preprocess
2021-03-18 18:09:59,236 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -     image = Image.open(io.BytesIO(image))
2021-03-18 18:09:59,237 [DEBUG] W-9000-WasteNet_1.0 org.pytorch.serve.wlm.Job - Waiting time ns: 165300, Inference time ns: 8981200
2021-03-18 18:09:59,237 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -   File "c:\users\mchintha\anaconda\lib\site-packages\PIL\Image.py", line 2622, in open
2021-03-18 18:09:59,238 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -     % (filename if filename else fp))
2021-03-18 18:09:59,238 [INFO ] W-9000-WasteNet_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle - OSError: cannot identify image file <_io.BytesIO object at 0x00000236FC0D6D00>

Torchserve is throwing this error when I send an HTTP POST request on Windows OS.

image839×389 27.8 KB

However, when I ran the Torchserve on a Linux OS. It is working just fine.
curl -X POST http://localhost:8443/predictions/WasteNet -T R_10396.jpg

It returned the predictions in a JSON format as expected.
I’ve used the same static files for running torchserve on both the OS. I was wondering if this is an OS error rather than a torchserve internal error.