pytorch / serve

Serve, optimize and scale PyTorch models in production
https://pytorch.org/serve/
Apache License 2.0
4.14k stars 835 forks source link

inference api doesn't send contents as json #2712

Open BeomseoChoi opened 11 months ago

BeomseoChoi commented 11 months ago

🚀 The feature

inference api should send json contents.

Motivation, pitch

return [json.dumps(response)]

I use above code on postprocess() method. and I call inference api /predictions/{model}/{version}. the content type of result is text, even I did change dict(response) to json.

Alternatives

No response

Additional context

Thanks.

IonBoleac commented 8 months ago

@BeomseoChoi to customize the handler did you extend BaseHandler?

IonBoleac commented 8 months ago

@BeomseoChoi by the way, type return must be a list because the web services necessities a list to send the response