Disable Base64 encoding on Audio files

I’m trying to create a Speech-to-text app using Dash and locally downloaded Whisper model (OpenAI). Whenever I get user input of the audio file, it’s converted to Base64 encoded string which isn’t compatible with Whisper.

My questions -

  1. Is there a way I can save the uploaded file as-is, in mp3 or wav format, rather than dealing with encoded version?
  2. Or, is there a way I can get audio attributes like channel, sampling etc to recreate audio file from encoded string?

Thanks in advance!

HI @suvigya welcome to the forums.

I guess you are uploading the adio file with an dcc.Upload(), right?

You could convert it back to whatever it was before. A quick google search returned this, for example.

@AIMPED Thanks for your prompt response. Yes, I am using dcc.upload() for getting user upload. I had to adapt the code to re-generate the file uploaded from the user depending on the format, but the link helped.

Thanks again!

1 Like