Trouble returning audio from Interference endpoints
Hi there,Thanks in advanced for the help. I am trying return audio from a model deployed to an inference endpoint.I am using a customhandler.pybut the inference endpoint does not support  an accept header asaudio/wav.  So we basically need a hack here. I though I would just encoded the wav file into a base64 string and embed the string in the json object.  That didn’t work - something in the json marshaling or unmarshaling is corrupting the wave file when in decode in the client.Then I though, well I am going to send request with theacceptas any other binary type likeimage/jpegbut the handler expects a PIL image as output.Finally, I triedtext/plainand return the base64 string directly but I keep getting this error:2023/08/14 23:26:55 ~ ERROR | 'NoneType' object has no attribute 'serialize'Even though when I send a request withaccept: image/jpegI get an error confirming that I am indeed returning the string:2023/08/14 23:07:26 ~ ERROR | Can only serialize PIL.Image.Image, got <class 'str'>I know this is a hack, but any ideas?thanks.
2023-08-15T05:49:35Z
Hello@pbotsaris,Thank you for opening the thread. I checked with the team and its correct we are currently not having an automatic serialization on the service for audio.When you sent*/*or json asacceptheader you get back the audio as base 64 string.Could you share what you are trying to do so we can prioritize and add this feature.
2024-02-28T17:20:47Z
@philschmidI am having this issue as well. I would like to send anAccept: 'audio/wav'header, for example, but that is not currently supported.Currently, there are convenient ways to returnvarious formats here, but there are no audio formats and that is a large part of inference on huggingface.@pbotsarisWere you able to solve this problem?