Hugging Face Inference Endpount comes with a default serving container which is used for all supported Transformers and Sentence-Transformers tasks and for custom inference handler.
The serving container takes care of serialization and deserialization of the request and response payloads based on the content-type and accept headers of the request.
That means that when you send a request with a JSON body and a content-type: application/json header, the serving container will deserialize the JSON payload into a Python dictionary and pass it to the inference handler and if you send
a request with a accept: image/png header, the serving container will serialize the response from the task/custom handler into a image.
Below is a list of supported content-types and the deserialized payload that is passed to the inference handler.
| Content-Type | Payload | 
|---|---|
| application/json | dict | 
| text/csv | raw | 
| text/plain | raw | 
| image/png | binary | 
| image/jpeg | binary | 
| image/jpg | binary | 
| image/tiff | binary | 
| image/bmp | binary | 
| image/gif | binary | 
| image/webp | binary | 
| image/x-image | binary | 
| audio/x-flac | {"inputs": bytes(body)} | 
| audio/flac | {"inputs": bytes(body)} | 
| audio/mpeg | {"inputs": bytes(body)} | 
| audio/x-mpeg-3 | {"inputs": bytes(body)} | 
| audio/wave | {"inputs": bytes(body)} | 
| audio/wav | {"inputs": bytes(body)} | 
| audio/x-wav | {"inputs": bytes(body)} | 
| audio/ogg | {"inputs": bytes(body)} | 
| audio/x-audio | {"inputs": bytes(body)} | 
| audio/webm | {"inputs": bytes(body)} | 
| audio/webm;codecs=opus | {"inputs": bytes(body)} | 
| audio/AMR | {"inputs": bytes(body)} | 
| audio/amr | {"inputs": bytes(body)} | 
| audio/AMR-WB | {"inputs": bytes(body)} | 
| audio/AMR-WB+ | {"inputs": bytes(body)} | 
| audio/m4a | {"inputs": bytes(body)} | 
| audio/x-m4a | {"inputs": bytes(body)} | 
Below is a list of supported accept headers and the serialized payload is returned.
| Accept | Payload | 
|---|---|
| application/json | JSON | 
| text/csv | raw | 
| text/plain | raw | 
| image/png | binary | 
| image/jpeg | binary | 
| image/jpg | binary | 
| image/tiff | binary | 
| image/bmp | binary | 
| image/gif | binary | 
| image/webp | binary | 
| image/x-image | binary |